Comments (6)
from insight.
class MetricFactory():
def metric_from_dict(self, d: Dict[str, Any]) -> Metric:
...
from insight.
"""
Option 1: MetricFactory in base.py
Step 1: Create a registry of all the metrics.
Substep: recurse through _Metric children in depth first search and add to to _registry with 'name' as the key
and class reference as the value.
Step 2: given a dictionary which contains the name of the metric and parameters, call the metric from _registry.
"""
class MetricFactory:
_registry: Dict[str, Any] = {}
@classmethod
def _update_registry_recuresively(cls, next_metric):
if next_metric.name is not None:
cls._registry.append({next_metric.name: next_metric})
for subclass in next_metric.__subclasses__():
cls._update_registry_recuresively(subclass)
@classmethod
def metric_from_dict(cls, bluprnt: Dict[str, any]):
if len (cls._registry) == 0:
cls._update_registry_recuresively(_Metric)
# STEP: Create a list of named parameters based on dictionary entries to pass into the Metric constructor.
new_metric = cls._registry[bluprnt['name']](...)
return new_metric
# Benefit: simple and does not interfere with the metrics.
from insight.
"""
Option 2: MetricFactory in metric.py or in a separate module.
Step 1: Create a registry of all the metrics.
Substep: recurse through OneColumnMetric, TwoColumnMetric, DataFrameMetric, and TwoDataFrameMetric children in
depth first search and add to to _registry with 'name' as the key and class reference as the value.
Step 2: given a dictionary which contains the name of the metric and parameters, call the metric from _registry.
"""
class MetricFactory:
_registry: Dict[str, Any] = {}
@classmethod
def _update_registry_recuresively(cls, next_metric):
if next_metric.name is not None:
cls._registry.append({next_metric.name: next_metric})
for subclass in next_metric.__subclasses__():
cls._update_registry_recuresively(subclass)
@classmethod
def metric_from_dict(cls, bluprnt: Dict[str, any]):
if len(cls._registry) == 0:
cls._update_registry_recuresively(OneColumnMetric)
cls._update_registry_recuresively(TwoColumnMetric)
cls._update_registry_recuresively(DataFrameMetric)
cls._update_registry_recuresively(TwoDataFrameMetric)
# STEP: Create a list of named parameters based on dictionary entries to pass into the Metric constructor.
new_metric = cls._registry[bluprnt['name']](...)
return new_metric
# Benefit: does not interfere with the metrics. Does not interfere with a private class.
from insight.
"""
Option 3: As a class method of _Metric.
Step 1: Create a registry of all the metrics.
Substep: recurse through OneColumnMetric, TwoColumnMetric, DataFrameMetric, and TwoDataFrameMetric children in
depth first search and add to to _registry with 'name' as the key and class reference as the value.
Step 2: given a dictionary which contains the name of the metric and parameters, call the metric from _registry.
"""
class _Metric:
_registry: Dict[str, Any] = {}
@classmethod
def _update_registry_recuresively(cls, next_metric):
if next_metric.name is not None:
cls._registry.append({next_metric.name: next_metric})
for subclass in next_metric.__subclasses__():
cls._update_registry_recuresively(subclass)
@classmethod
def metric_from_dict(cls, bluprnt: Dict[str, any]):
if len(cls._registry) == 0:
cls._update_registry_recuresively(cls)
# STEP: Create a list of named parameters based on dictionary entries to pass into the Metric constructor.
new_metric = cls._registry[bluprnt['name']](...)
return new_metric
# Benefit: Can call from any metric with the same result.
from insight.
Note: what is labelled as a STEP should be possible to do through argument list unpacking.
from insight.
Related Issues (20)
- Change the reference of ColumnCheck to Check and handle method infer_dtype
- Cramer's V Produces NaNs on COMPAS
- Error in bin centre computation for EMD HOT 2
- Complicated matrix metric return type.
- Remove insight folder in SDK (including tests) HOT 1
- Overview of synthesized-io/insight HOT 2
- Refactor synthesized-io/insight repo
- Additional metrics (+tests) HOT 2
- Be able to effectively plot visualizations of different metrics HOT 1
- Easily save the results of a synthesis trial to a database including: the metrics and value the dataset the generative model HOT 1
- Using Docker Compose, configure a database and Grafana dashboard for monitoring metrics
- Metrics returning infinity as a result
- Kendall Tau Correlation metric peformance issues.
- Add typing stubs HOT 2
- Incorporate synthesized evaluation framework into insight
- TypeError for columns with dtype=object that could be inferred as numeric dtype
- Create/Add metrics for missing values
- Insight EarthMoversDistance cannot deal with ints vs floats comparison
- Optimization list for metrics
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from insight.