Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
MatsMoll committed Jan 16, 2024
1 parent 78c28bc commit 2155a6c
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 107 deletions.
9 changes: 7 additions & 2 deletions aligned/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ async def freshness(self) -> dict[FeatureLocation, datetime | None]:

return await self.store.feature_source.freshness_for(locs)

def with_labels(self) -> SupervisedModelFeatureStore:
def with_labels(self, label_refs: set[FeatureReferance] | None = None) -> SupervisedModelFeatureStore:
"""Will also load the labels for the model
```python
Expand All @@ -847,7 +847,12 @@ def with_labels(self) -> SupervisedModelFeatureStore:
Returns:
SupervisedModelFeatureStore: A new queryable feature store
"""
return SupervisedModelFeatureStore(self.model, self.store, self.selected_version)
return SupervisedModelFeatureStore(
self.model,
self.store,
label_refs or self.model.predictions_view.labels_estimates_refs(),
self.selected_version,
)

def cached_at(self, location: DataFileReference) -> RetrivalJob:
"""Loads the model features from a pre computed location
Expand Down
Binary file modified test_data/credit_history_mater.parquet
Binary file not shown.
2 changes: 1 addition & 1 deletion test_data/feature-store.json

Large diffs are not rendered by default.

Binary file modified test_data/test_model.parquet
Binary file not shown.
2 changes: 1 addition & 1 deletion test_data/titanic-sets.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"raw_data": [], "train_test": [], "train_test_validation": [{"id": "titanic_test", "name": null, "request_result": {"entities": [{"name": "passenger_id", "dtype": {"name": "int32"}, "description": null, "tags": null, "constraints": null}], "features": [{"name": "cabin", "dtype": {"name": "string"}, "description": null, "tags": null, "constraints": [{"name": "optional"}]}, {"name": "has_siblings", "dtype": {"name": "bool"}, "description": null, "tags": null, "constraints": null, "depending_on": [{"name": "sibsp", "location": {"name": "titanic", "location": "feature_view"}, "dtype": {"name": "int32"}}], "transformation": {"name": "not-equals", "dtype": {"name": "bool"}, "key": "sibsp", "value": {"name": "int", "value": 0}}, "depth": 1}, {"name": "is_female", "dtype": {"name": "bool"}, "description": null, "tags": null, "constraints": null, "depending_on": [{"name": "sex", "location": {"name": "titanic", "location": "feature_view"}, "dtype": {"name": "string"}}], "transformation": {"name": "equals", "dtype": {"name": "bool"}, "key": "sex", "value": {"name": "string", "value": "female"}}, "depth": 1}, {"name": "is_mr", "dtype": {"name": "bool"}, "description": null, "tags": null, "constraints": null, "depending_on": [{"name": "name", "location": {"name": "titanic", "location": "feature_view"}, "dtype": {"name": "string"}}], "transformation": {"name": "contains", "dtype": {"name": "bool"}, "key": "name", "value": "Mr."}, "depth": 1}, {"name": "name", "dtype": {"name": "string"}, "description": null, "tags": null, "constraints": [{"name": "optional"}]}, {"name": "survived", "dtype": {"name": "bool"}, "description": "If the passenger survived", "tags": null, "constraints": null}, {"name": "is_male", "dtype": {"name": "bool"}, "description": null, "tags": null, "constraints": null, "depending_on": [{"name": "sex", "location": {"name": "titanic", "location": "feature_view"}, "dtype": {"name": "string"}}], "transformation": {"name": "equals", "dtype": {"name": "bool"}, "key": "sex", "value": {"name": "string", "value": "male"}}, "depth": 1}, {"name": "sex", "dtype": {"name": "string"}, "description": null, "tags": null, "constraints": [{"name": "in_domain", "values": ["male", "female"]}, {"name": "optional"}]}, {"name": "sibsp", "dtype": {"name": "int32"}, "description": "Number of siblings on titanic", "tags": null, "constraints": [{"name": "upper_bound_inc", "value": 20.0}, {"name": "lower_bound_inc", "value": 0.0}, {"name": "optional"}]}, {"name": "age", "dtype": {"name": "float"}, "description": "A float as some have decimals", "tags": null, "constraints": [{"name": "upper_bound_inc", "value": 100.0}, {"name": "lower_bound_inc", "value": 0.0}]}], "event_timestamp": null}, "train_dataset": {"mapping_keys": {}, "type_name": "csv", "path": "test_data/titanic-train.csv", "csv_config": {"seperator": ",", "compression": "infer", "should_write_index": false}}, "test_dataset": {"mapping_keys": {}, "type_name": "csv", "path": "test_data/titanic-test.csv", "csv_config": {"seperator": ",", "compression": "infer", "should_write_index": false}}, "validation_dataset": {"mapping_keys": {}, "type_name": "csv", "path": "test_data/titanic-validate.csv", "csv_config": {"seperator": ",", "compression": "infer", "should_write_index": false}}, "train_size_fraction": 0.6, "test_size_fraction": 0.20000000000000007, "validate_size_fraction": 0.19999999999999996, "target": ["survived"], "description": null, "tags": null}], "active_learning": []}
{"raw_data": [], "train_test": [], "train_test_validation": [{"id": "titanic_test", "name": null, "request_result": {"entities": [{"name": "passenger_id", "dtype": {"name": "int32"}, "description": null, "tags": null, "constraints": null}], "features": [{"name": "survived", "dtype": {"name": "bool"}, "description": "If the passenger survived", "tags": null, "constraints": null}, {"name": "is_mr", "dtype": {"name": "bool"}, "description": null, "tags": null, "constraints": null, "depending_on": [{"name": "name", "location": {"name": "titanic", "location": "feature_view"}, "dtype": {"name": "string"}}], "transformation": {"name": "contains", "dtype": {"name": "bool"}, "key": "name", "value": "Mr."}, "depth": 1}, {"name": "age", "dtype": {"name": "float"}, "description": "A float as some have decimals", "tags": null, "constraints": [{"name": "lower_bound_inc", "value": 0.0}, {"name": "upper_bound_inc", "value": 100.0}]}, {"name": "cabin", "dtype": {"name": "string"}, "description": null, "tags": null, "constraints": [{"name": "optional"}]}, {"name": "name", "dtype": {"name": "string"}, "description": null, "tags": null, "constraints": [{"name": "optional"}]}, {"name": "sibsp", "dtype": {"name": "int32"}, "description": "Number of siblings on titanic", "tags": null, "constraints": [{"name": "lower_bound_inc", "value": 0.0}, {"name": "optional"}, {"name": "upper_bound_inc", "value": 20.0}]}, {"name": "is_male", "dtype": {"name": "bool"}, "description": null, "tags": null, "constraints": null, "depending_on": [{"name": "sex", "location": {"name": "titanic", "location": "feature_view"}, "dtype": {"name": "string"}}], "transformation": {"name": "equals", "dtype": {"name": "bool"}, "key": "sex", "value": {"name": "string", "value": "male"}}, "depth": 1}, {"name": "is_female", "dtype": {"name": "bool"}, "description": null, "tags": null, "constraints": null, "depending_on": [{"name": "sex", "location": {"name": "titanic", "location": "feature_view"}, "dtype": {"name": "string"}}], "transformation": {"name": "equals", "dtype": {"name": "bool"}, "key": "sex", "value": {"name": "string", "value": "female"}}, "depth": 1}, {"name": "has_siblings", "dtype": {"name": "bool"}, "description": null, "tags": null, "constraints": null, "depending_on": [{"name": "sibsp", "location": {"name": "titanic", "location": "feature_view"}, "dtype": {"name": "int32"}}], "transformation": {"name": "not-equals", "dtype": {"name": "bool"}, "key": "sibsp", "value": {"name": "int", "value": 0}}, "depth": 1}, {"name": "sex", "dtype": {"name": "string"}, "description": null, "tags": null, "constraints": [{"name": "in_domain", "values": ["male", "female"]}, {"name": "optional"}]}], "event_timestamp": null}, "train_dataset": {"mapping_keys": {}, "type_name": "csv", "path": "test_data/titanic-train.csv", "csv_config": {"seperator": ",", "compression": "infer", "should_write_index": false}}, "test_dataset": {"mapping_keys": {}, "type_name": "csv", "path": "test_data/titanic-test.csv", "csv_config": {"seperator": ",", "compression": "infer", "should_write_index": false}}, "validation_dataset": {"mapping_keys": {}, "type_name": "csv", "path": "test_data/titanic-validate.csv", "csv_config": {"seperator": ",", "compression": "infer", "should_write_index": false}}, "train_size_fraction": 0.6, "test_size_fraction": 0.20000000000000007, "validate_size_fraction": 0.19999999999999996, "target": ["survived"], "description": null, "tags": null}], "active_learning": []}
42 changes: 21 additions & 21 deletions test_data/titanic-test.csv
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
cabin,has_siblings,is_female,is_mr,name,survived,age,is_male,sex,sibsp,passenger_id
,False,False,True,"Sirayanian, Mr. Orsen",False,22.0,True,male,0,61
B28,False,True,False,"Icard, Miss. Amelie",True,38.0,False,female,0,62
C83,True,False,True,"Harris, Mr. Henry Birkhardt",False,45.0,True,male,1,63
,True,False,False,"Skoog, Master. Harald",False,4.0,True,male,3,64
,False,False,True,"Stewart, Mr. Albert A",False,,True,male,0,65
,True,False,False,"Moubarek, Master. Gerios",True,,True,male,1,66
F33,False,True,True,"Nye, Mrs. (Elizabeth Ramell)",True,29.0,False,female,0,67
,False,False,True,"Crease, Mr. Ernest James",False,19.0,True,male,0,68
,True,True,False,"Andersson, Miss. Erna Alexandra",True,17.0,False,female,4,69
,True,False,True,"Kink, Mr. Vincenz",False,26.0,True,male,2,70
,False,False,True,"Jenkin, Mr. Stephen Curnow",False,32.0,True,male,0,71
,True,True,False,"Goodwin, Miss. Lillian Amy",False,16.0,False,female,5,72
,False,False,True,"Hood, Mr. Ambrose Jr",False,21.0,True,male,0,73
,True,False,True,"Chronopoulos, Mr. Apostolos",False,26.0,True,male,1,74
,False,False,True,"Bing, Mr. Lee",True,32.0,True,male,0,75
F G73,False,False,True,"Moen, Mr. Sigurd Hansen",False,25.0,True,male,0,76
,False,False,True,"Staneff, Mr. Ivan",False,,True,male,0,77
,False,False,True,"Moutal, Mr. Rahamin Haim",False,,True,male,0,78
,False,False,False,"Caldwell, Master. Alden Gates",True,0.83,True,male,0,79
,False,True,False,"Dowdell, Miss. Elizabeth",True,30.0,False,female,0,80
passenger_id,has_siblings,is_mr,age,cabin,name,sibsp,is_male,is_female,survived,sex
61,False,True,22.0,,"Sirayanian, Mr. Orsen",0,True,False,False,male
62,False,False,38.0,B28,"Icard, Miss. Amelie",0,False,True,True,female
63,True,True,45.0,C83,"Harris, Mr. Henry Birkhardt",1,True,False,False,male
64,True,False,4.0,,"Skoog, Master. Harald",3,True,False,False,male
65,False,True,,,"Stewart, Mr. Albert A",0,True,False,False,male
66,True,False,,,"Moubarek, Master. Gerios",1,True,False,True,male
67,False,True,29.0,F33,"Nye, Mrs. (Elizabeth Ramell)",0,False,True,True,female
68,False,True,19.0,,"Crease, Mr. Ernest James",0,True,False,False,male
69,True,False,17.0,,"Andersson, Miss. Erna Alexandra",4,False,True,True,female
70,True,True,26.0,,"Kink, Mr. Vincenz",2,True,False,False,male
71,False,True,32.0,,"Jenkin, Mr. Stephen Curnow",0,True,False,False,male
72,True,False,16.0,,"Goodwin, Miss. Lillian Amy",5,False,True,False,female
73,False,True,21.0,,"Hood, Mr. Ambrose Jr",0,True,False,False,male
74,True,True,26.0,,"Chronopoulos, Mr. Apostolos",1,True,False,False,male
75,False,True,32.0,,"Bing, Mr. Lee",0,True,False,True,male
76,False,True,25.0,F G73,"Moen, Mr. Sigurd Hansen",0,True,False,False,male
77,False,True,,,"Staneff, Mr. Ivan",0,True,False,False,male
78,False,True,,,"Moutal, Mr. Rahamin Haim",0,True,False,False,male
79,False,False,0.83,,"Caldwell, Master. Alden Gates",0,True,False,True,male
80,False,False,30.0,,"Dowdell, Miss. Elizabeth",0,False,True,True,female
Loading

0 comments on commit 2155a6c

Please sign in to comment.