easy_ml 0.2.0.pre.rc56 → 0.2.0.pre.rc58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/easy_ml/apis_controller.rb +8 -0
- data/app/controllers/easy_ml/models_controller.rb +3 -0
- data/app/controllers/easy_ml/predictions_controller.rb +10 -5
- data/app/frontend/components/ModelForm.tsx +1 -1
- data/app/frontend/components/SearchableSelect.tsx +0 -1
- data/app/frontend/components/dataset/PreprocessingConfig.tsx +1 -1
- data/app/frontend/pages/DatasourcesPage.tsx +0 -2
- data/app/jobs/easy_ml/compute_feature_job.rb +1 -0
- data/app/models/easy_ml/column.rb +55 -4
- data/app/models/easy_ml/column_history.rb +5 -1
- data/app/models/easy_ml/column_list.rb +46 -14
- data/app/models/easy_ml/dataset.rb +47 -27
- data/app/models/easy_ml/datasource.rb +1 -0
- data/app/models/easy_ml/feature.rb +10 -3
- data/app/models/easy_ml/model.rb +30 -6
- data/app/models/easy_ml/model_history.rb +1 -0
- data/app/models/easy_ml/models/xgboost/evals_callback.rb +4 -3
- data/app/models/easy_ml/retraining_run.rb +1 -0
- data/config/initializers/inflections.rb +2 -0
- data/config/routes.rb +3 -0
- data/lib/easy_ml/core/evaluators/base_evaluator.rb +1 -1
- data/lib/easy_ml/core/evaluators/classification_evaluators.rb +9 -9
- data/lib/easy_ml/core/evaluators/regression_evaluators.rb +4 -4
- data/lib/easy_ml/core/model_evaluator.rb +18 -3
- data/lib/easy_ml/core/tuner.rb +23 -17
- data/lib/easy_ml/data/preprocessor.rb +10 -53
- data/lib/easy_ml/data/splits/in_memory_split.rb +4 -0
- data/lib/easy_ml/data/statistics_learner.rb +79 -14
- data/lib/easy_ml/data/synced_directory.rb +4 -2
- data/lib/easy_ml/predict.rb +13 -2
- data/lib/easy_ml/railtie/generators/migration/migration_generator.rb +3 -0
- data/lib/easy_ml/railtie/templates/migration/add_computed_columns_to_easy_ml_columns.rb.tt +14 -0
- data/lib/easy_ml/railtie/templates/migration/add_default_to_is_target.rb.tt +6 -0
- data/lib/easy_ml/railtie/templates/migration/add_slug_to_easy_ml_models.rb.tt +20 -0
- data/lib/easy_ml/version.rb +1 -1
- data/public/easy_ml/assets/.vite/manifest.json +1 -1
- data/public/easy_ml/assets/assets/entrypoints/{Application.tsx-DTZ2348z.js → Application.tsx-DmkdJsDd.js} +34 -34
- data/public/easy_ml/assets/assets/entrypoints/{Application.tsx-DTZ2348z.js.map → Application.tsx-DmkdJsDd.js.map} +1 -1
- metadata +8 -4
data/lib/easy_ml/predict.rb
CHANGED
@@ -10,11 +10,17 @@ module EasyML
|
|
10
10
|
@models = {}
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.
|
13
|
+
def self.normalize_input(df)
|
14
14
|
if df.is_a?(Hash)
|
15
15
|
df = Polars::DataFrame.new(df)
|
16
16
|
end
|
17
|
+
df
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.predict(model_name, df, serialize: false)
|
21
|
+
df = normalize_input(df)
|
17
22
|
raw_input = df.to_hashes
|
23
|
+
|
18
24
|
df = instance.normalize(model_name, df)
|
19
25
|
normalized_input = df.to_hashes
|
20
26
|
preds = instance.predict(model_name, df)
|
@@ -52,6 +58,11 @@ module EasyML
|
|
52
58
|
get_model(model_name).predict(df)
|
53
59
|
end
|
54
60
|
|
61
|
+
def self.validate_input(model_name, df)
|
62
|
+
df = normalize_input(df)
|
63
|
+
instance.get_model(model_name).dataset.validate_input(df)
|
64
|
+
end
|
65
|
+
|
55
66
|
def normalize(model_name, df)
|
56
67
|
get_model(model_name).dataset.normalize(df, inference: true)
|
57
68
|
end
|
@@ -72,7 +83,7 @@ module EasyML
|
|
72
83
|
private
|
73
84
|
|
74
85
|
def load_model(model_name)
|
75
|
-
current_model = EasyML::Model.find_by!(
|
86
|
+
current_model = EasyML::Model.find_by!(slug: model_name).inference_version
|
76
87
|
|
77
88
|
# Load new model if not loaded or different version
|
78
89
|
model_not_loaded = models[model_name].nil?
|
@@ -41,6 +41,9 @@ module EasyML
|
|
41
41
|
add_workflow_status_to_easy_ml_features
|
42
42
|
drop_path_from_easy_ml_model_files
|
43
43
|
add_is_date_column_to_easy_ml_columns
|
44
|
+
add_computed_columns_to_easy_ml_columns
|
45
|
+
add_slug_to_easy_ml_models
|
46
|
+
add_default_to_is_target
|
44
47
|
].freeze
|
45
48
|
|
46
49
|
# Specify the next migration number
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class AddComputedColumnsToEasyMLColumns < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
2
|
+
def change
|
3
|
+
add_column :easy_ml_columns, :computed_by, :string
|
4
|
+
add_column :easy_ml_columns, :is_computed, :boolean, default: false
|
5
|
+
|
6
|
+
add_index :easy_ml_columns, :computed_by
|
7
|
+
add_index :easy_ml_columns, :is_computed
|
8
|
+
|
9
|
+
add_column :easy_ml_column_histories, :computed_by, :string
|
10
|
+
add_index :easy_ml_column_histories, :computed_by
|
11
|
+
add_column :easy_ml_column_histories, :is_computed, :boolean, default: false
|
12
|
+
add_index :easy_ml_column_histories, :is_computed
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class AddSlugToEasyMLModels < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
2
|
+
def change
|
3
|
+
add_column :easy_ml_models, :slug, :string
|
4
|
+
add_index :easy_ml_models, :slug, unique: true
|
5
|
+
|
6
|
+
reversible do |dir|
|
7
|
+
dir.up do
|
8
|
+
execute <<-SQL
|
9
|
+
UPDATE easy_ml_models
|
10
|
+
SET slug = LOWER(REPLACE(name, ' ', '_'))
|
11
|
+
SQL
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
change_column_null :easy_ml_models, :slug, false
|
16
|
+
|
17
|
+
add_column :easy_ml_model_histories, :slug, :string
|
18
|
+
add_index :easy_ml_model_histories, :slug
|
19
|
+
end
|
20
|
+
end
|
data/lib/easy_ml/version.rb
CHANGED