snowflake-ml-python 1.6.1__py3-none-any.whl → 1.6.3__py3-none-any.whl
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.
- snowflake/cortex/__init__.py +4 -0
- snowflake/cortex/_classify_text.py +2 -2
- snowflake/cortex/_embed_text_1024.py +37 -0
- snowflake/cortex/_embed_text_768.py +37 -0
- snowflake/cortex/_extract_answer.py +2 -2
- snowflake/cortex/_sentiment.py +2 -2
- snowflake/cortex/_summarize.py +2 -2
- snowflake/cortex/_translate.py +2 -2
- snowflake/cortex/_util.py +4 -4
- snowflake/ml/_internal/env_utils.py +5 -5
- snowflake/ml/_internal/exceptions/error_codes.py +2 -0
- snowflake/ml/_internal/telemetry.py +142 -20
- snowflake/ml/_internal/utils/db_utils.py +50 -0
- snowflake/ml/_internal/utils/identifier.py +48 -11
- snowflake/ml/_internal/utils/service_logger.py +63 -0
- snowflake/ml/_internal/utils/snowflake_env.py +23 -13
- snowflake/ml/_internal/utils/sql_identifier.py +26 -2
- snowflake/ml/_internal/utils/table_manager.py +19 -1
- snowflake/ml/data/_internal/arrow_ingestor.py +1 -11
- snowflake/ml/data/data_connector.py +33 -7
- snowflake/ml/data/ingestor_utils.py +20 -10
- snowflake/ml/data/torch_utils.py +68 -0
- snowflake/ml/dataset/dataset.py +1 -3
- snowflake/ml/feature_store/access_manager.py +3 -3
- snowflake/ml/feature_store/feature_store.py +60 -19
- snowflake/ml/feature_store/feature_view.py +84 -30
- snowflake/ml/fileset/embedded_stage_fs.py +1 -1
- snowflake/ml/fileset/fileset.py +1 -1
- snowflake/ml/fileset/sfcfs.py +9 -3
- snowflake/ml/fileset/stage_fs.py +2 -1
- snowflake/ml/lineage/lineage_node.py +7 -2
- snowflake/ml/model/__init__.py +1 -2
- snowflake/ml/model/_client/model/model_version_impl.py +96 -12
- snowflake/ml/model/_client/ops/model_ops.py +124 -6
- snowflake/ml/model/_client/ops/service_ops.py +309 -9
- snowflake/ml/model/_client/service/model_deployment_spec.py +8 -5
- snowflake/ml/model/_client/service/model_deployment_spec_schema.py +2 -2
- snowflake/ml/model/_client/sql/_base.py +5 -0
- snowflake/ml/model/_client/sql/model.py +1 -0
- snowflake/ml/model/_client/sql/model_version.py +9 -5
- snowflake/ml/model/_client/sql/service.py +121 -20
- snowflake/ml/model/_model_composer/model_composer.py +11 -39
- snowflake/ml/model/_model_composer/model_manifest/model_manifest.py +31 -11
- snowflake/ml/model/_packager/model_env/model_env.py +4 -38
- snowflake/ml/model/_packager/model_handlers/_utils.py +134 -28
- snowflake/ml/model/_packager/model_handlers/catboost.py +31 -30
- snowflake/ml/model/_packager/model_handlers/huggingface_pipeline.py +26 -18
- snowflake/ml/model/_packager/model_handlers/lightgbm.py +31 -58
- snowflake/ml/model/_packager/model_handlers/mlflow.py +3 -5
- snowflake/ml/model/_packager/model_handlers/model_objective_utils.py +169 -0
- snowflake/ml/model/_packager/model_handlers/sentence_transformers.py +15 -8
- snowflake/ml/model/_packager/model_handlers/sklearn.py +56 -60
- snowflake/ml/model/_packager/model_handlers/snowmlmodel.py +141 -9
- snowflake/ml/model/_packager/model_handlers/torchscript.py +2 -2
- snowflake/ml/model/_packager/model_handlers/xgboost.py +63 -48
- snowflake/ml/model/_packager/model_meta/model_meta.py +16 -42
- snowflake/ml/model/_packager/model_meta/model_meta_schema.py +1 -14
- snowflake/ml/model/_packager/model_packager.py +14 -8
- snowflake/ml/model/_packager/model_runtime/model_runtime.py +11 -0
- snowflake/ml/model/_signatures/pytorch_handler.py +1 -1
- snowflake/ml/model/_signatures/snowpark_handler.py +3 -2
- snowflake/ml/model/_signatures/utils.py +9 -0
- snowflake/ml/model/type_hints.py +12 -145
- snowflake/ml/modeling/_internal/constants.py +1 -0
- snowflake/ml/modeling/_internal/local_implementations/pandas_handlers.py +5 -5
- snowflake/ml/modeling/_internal/local_implementations/pandas_trainer.py +9 -6
- snowflake/ml/modeling/_internal/model_specifications.py +2 -0
- snowflake/ml/modeling/_internal/model_trainer.py +1 -0
- snowflake/ml/modeling/_internal/snowpark_implementations/distributed_hpo_trainer.py +2 -4
- snowflake/ml/modeling/_internal/snowpark_implementations/snowpark_handlers.py +5 -5
- snowflake/ml/modeling/_internal/snowpark_implementations/snowpark_trainer.py +130 -166
- snowflake/ml/modeling/_internal/snowpark_implementations/xgboost_external_memory_trainer.py +0 -1
- snowflake/ml/modeling/calibration/calibrated_classifier_cv.py +61 -21
- snowflake/ml/modeling/cluster/affinity_propagation.py +61 -21
- snowflake/ml/modeling/cluster/agglomerative_clustering.py +61 -21
- snowflake/ml/modeling/cluster/birch.py +61 -21
- snowflake/ml/modeling/cluster/bisecting_k_means.py +61 -21
- snowflake/ml/modeling/cluster/dbscan.py +61 -21
- snowflake/ml/modeling/cluster/feature_agglomeration.py +61 -21
- snowflake/ml/modeling/cluster/k_means.py +61 -21
- snowflake/ml/modeling/cluster/mean_shift.py +61 -21
- snowflake/ml/modeling/cluster/mini_batch_k_means.py +61 -21
- snowflake/ml/modeling/cluster/optics.py +61 -21
- snowflake/ml/modeling/cluster/spectral_biclustering.py +61 -21
- snowflake/ml/modeling/cluster/spectral_clustering.py +61 -21
- snowflake/ml/modeling/cluster/spectral_coclustering.py +61 -21
- snowflake/ml/modeling/compose/column_transformer.py +61 -21
- snowflake/ml/modeling/compose/transformed_target_regressor.py +61 -21
- snowflake/ml/modeling/covariance/elliptic_envelope.py +61 -21
- snowflake/ml/modeling/covariance/empirical_covariance.py +61 -21
- snowflake/ml/modeling/covariance/graphical_lasso.py +61 -21
- snowflake/ml/modeling/covariance/graphical_lasso_cv.py +61 -21
- snowflake/ml/modeling/covariance/ledoit_wolf.py +61 -21
- snowflake/ml/modeling/covariance/min_cov_det.py +61 -21
- snowflake/ml/modeling/covariance/oas.py +61 -21
- snowflake/ml/modeling/covariance/shrunk_covariance.py +61 -21
- snowflake/ml/modeling/decomposition/dictionary_learning.py +61 -21
- snowflake/ml/modeling/decomposition/factor_analysis.py +61 -21
- snowflake/ml/modeling/decomposition/fast_ica.py +61 -21
- snowflake/ml/modeling/decomposition/incremental_pca.py +61 -21
- snowflake/ml/modeling/decomposition/kernel_pca.py +61 -21
- snowflake/ml/modeling/decomposition/mini_batch_dictionary_learning.py +61 -21
- snowflake/ml/modeling/decomposition/mini_batch_sparse_pca.py +61 -21
- snowflake/ml/modeling/decomposition/pca.py +61 -21
- snowflake/ml/modeling/decomposition/sparse_pca.py +61 -21
- snowflake/ml/modeling/decomposition/truncated_svd.py +61 -21
- snowflake/ml/modeling/discriminant_analysis/linear_discriminant_analysis.py +61 -21
- snowflake/ml/modeling/discriminant_analysis/quadratic_discriminant_analysis.py +61 -21
- snowflake/ml/modeling/ensemble/ada_boost_classifier.py +61 -21
- snowflake/ml/modeling/ensemble/ada_boost_regressor.py +61 -21
- snowflake/ml/modeling/ensemble/bagging_classifier.py +61 -21
- snowflake/ml/modeling/ensemble/bagging_regressor.py +61 -21
- snowflake/ml/modeling/ensemble/extra_trees_classifier.py +61 -21
- snowflake/ml/modeling/ensemble/extra_trees_regressor.py +61 -21
- snowflake/ml/modeling/ensemble/gradient_boosting_classifier.py +61 -21
- snowflake/ml/modeling/ensemble/gradient_boosting_regressor.py +61 -21
- snowflake/ml/modeling/ensemble/hist_gradient_boosting_classifier.py +61 -21
- snowflake/ml/modeling/ensemble/hist_gradient_boosting_regressor.py +61 -21
- snowflake/ml/modeling/ensemble/isolation_forest.py +61 -21
- snowflake/ml/modeling/ensemble/random_forest_classifier.py +61 -21
- snowflake/ml/modeling/ensemble/random_forest_regressor.py +61 -21
- snowflake/ml/modeling/ensemble/stacking_regressor.py +61 -21
- snowflake/ml/modeling/ensemble/voting_classifier.py +61 -21
- snowflake/ml/modeling/ensemble/voting_regressor.py +61 -21
- snowflake/ml/modeling/feature_selection/generic_univariate_select.py +61 -21
- snowflake/ml/modeling/feature_selection/select_fdr.py +61 -21
- snowflake/ml/modeling/feature_selection/select_fpr.py +61 -21
- snowflake/ml/modeling/feature_selection/select_fwe.py +61 -21
- snowflake/ml/modeling/feature_selection/select_k_best.py +61 -21
- snowflake/ml/modeling/feature_selection/select_percentile.py +61 -21
- snowflake/ml/modeling/feature_selection/sequential_feature_selector.py +61 -21
- snowflake/ml/modeling/feature_selection/variance_threshold.py +61 -21
- snowflake/ml/modeling/gaussian_process/gaussian_process_classifier.py +61 -21
- snowflake/ml/modeling/gaussian_process/gaussian_process_regressor.py +61 -21
- snowflake/ml/modeling/impute/iterative_imputer.py +61 -21
- snowflake/ml/modeling/impute/knn_imputer.py +61 -21
- snowflake/ml/modeling/impute/missing_indicator.py +61 -21
- snowflake/ml/modeling/kernel_approximation/additive_chi2_sampler.py +61 -21
- snowflake/ml/modeling/kernel_approximation/nystroem.py +61 -21
- snowflake/ml/modeling/kernel_approximation/polynomial_count_sketch.py +61 -21
- snowflake/ml/modeling/kernel_approximation/rbf_sampler.py +61 -21
- snowflake/ml/modeling/kernel_approximation/skewed_chi2_sampler.py +61 -21
- snowflake/ml/modeling/kernel_ridge/kernel_ridge.py +61 -21
- snowflake/ml/modeling/lightgbm/lgbm_classifier.py +61 -21
- snowflake/ml/modeling/lightgbm/lgbm_regressor.py +61 -21
- snowflake/ml/modeling/linear_model/ard_regression.py +61 -21
- snowflake/ml/modeling/linear_model/bayesian_ridge.py +61 -21
- snowflake/ml/modeling/linear_model/elastic_net.py +61 -21
- snowflake/ml/modeling/linear_model/elastic_net_cv.py +61 -21
- snowflake/ml/modeling/linear_model/gamma_regressor.py +61 -21
- snowflake/ml/modeling/linear_model/huber_regressor.py +61 -21
- snowflake/ml/modeling/linear_model/lars.py +61 -21
- snowflake/ml/modeling/linear_model/lars_cv.py +61 -21
- snowflake/ml/modeling/linear_model/lasso.py +61 -21
- snowflake/ml/modeling/linear_model/lasso_cv.py +61 -21
- snowflake/ml/modeling/linear_model/lasso_lars.py +61 -21
- snowflake/ml/modeling/linear_model/lasso_lars_cv.py +61 -21
- snowflake/ml/modeling/linear_model/lasso_lars_ic.py +61 -21
- snowflake/ml/modeling/linear_model/linear_regression.py +61 -21
- snowflake/ml/modeling/linear_model/logistic_regression.py +61 -21
- snowflake/ml/modeling/linear_model/logistic_regression_cv.py +61 -21
- snowflake/ml/modeling/linear_model/multi_task_elastic_net.py +61 -21
- snowflake/ml/modeling/linear_model/multi_task_elastic_net_cv.py +61 -21
- snowflake/ml/modeling/linear_model/multi_task_lasso.py +61 -21
- snowflake/ml/modeling/linear_model/multi_task_lasso_cv.py +61 -21
- snowflake/ml/modeling/linear_model/orthogonal_matching_pursuit.py +61 -21
- snowflake/ml/modeling/linear_model/passive_aggressive_classifier.py +61 -21
- snowflake/ml/modeling/linear_model/passive_aggressive_regressor.py +61 -21
- snowflake/ml/modeling/linear_model/perceptron.py +61 -21
- snowflake/ml/modeling/linear_model/poisson_regressor.py +61 -21
- snowflake/ml/modeling/linear_model/ransac_regressor.py +61 -21
- snowflake/ml/modeling/linear_model/ridge.py +61 -21
- snowflake/ml/modeling/linear_model/ridge_classifier.py +61 -21
- snowflake/ml/modeling/linear_model/ridge_classifier_cv.py +61 -21
- snowflake/ml/modeling/linear_model/ridge_cv.py +61 -21
- snowflake/ml/modeling/linear_model/sgd_classifier.py +61 -21
- snowflake/ml/modeling/linear_model/sgd_one_class_svm.py +61 -21
- snowflake/ml/modeling/linear_model/sgd_regressor.py +61 -21
- snowflake/ml/modeling/linear_model/theil_sen_regressor.py +61 -21
- snowflake/ml/modeling/linear_model/tweedie_regressor.py +61 -21
- snowflake/ml/modeling/manifold/isomap.py +61 -21
- snowflake/ml/modeling/manifold/mds.py +61 -21
- snowflake/ml/modeling/manifold/spectral_embedding.py +61 -21
- snowflake/ml/modeling/manifold/tsne.py +61 -21
- snowflake/ml/modeling/metrics/metrics_utils.py +2 -2
- snowflake/ml/modeling/metrics/ranking.py +0 -3
- snowflake/ml/modeling/metrics/regression.py +0 -3
- snowflake/ml/modeling/mixture/bayesian_gaussian_mixture.py +61 -21
- snowflake/ml/modeling/mixture/gaussian_mixture.py +61 -21
- snowflake/ml/modeling/multiclass/one_vs_one_classifier.py +61 -21
- snowflake/ml/modeling/multiclass/one_vs_rest_classifier.py +61 -21
- snowflake/ml/modeling/multiclass/output_code_classifier.py +61 -21
- snowflake/ml/modeling/naive_bayes/bernoulli_nb.py +61 -21
- snowflake/ml/modeling/naive_bayes/categorical_nb.py +61 -21
- snowflake/ml/modeling/naive_bayes/complement_nb.py +61 -21
- snowflake/ml/modeling/naive_bayes/gaussian_nb.py +61 -21
- snowflake/ml/modeling/naive_bayes/multinomial_nb.py +61 -21
- snowflake/ml/modeling/neighbors/k_neighbors_classifier.py +61 -21
- snowflake/ml/modeling/neighbors/k_neighbors_regressor.py +61 -21
- snowflake/ml/modeling/neighbors/kernel_density.py +61 -21
- snowflake/ml/modeling/neighbors/local_outlier_factor.py +61 -21
- snowflake/ml/modeling/neighbors/nearest_centroid.py +61 -21
- snowflake/ml/modeling/neighbors/nearest_neighbors.py +61 -21
- snowflake/ml/modeling/neighbors/neighborhood_components_analysis.py +61 -21
- snowflake/ml/modeling/neighbors/radius_neighbors_classifier.py +61 -21
- snowflake/ml/modeling/neighbors/radius_neighbors_regressor.py +61 -21
- snowflake/ml/modeling/neural_network/bernoulli_rbm.py +61 -21
- snowflake/ml/modeling/neural_network/mlp_classifier.py +61 -21
- snowflake/ml/modeling/neural_network/mlp_regressor.py +61 -21
- snowflake/ml/modeling/parameters/disable_model_tracer.py +5 -0
- snowflake/ml/modeling/pipeline/pipeline.py +1 -13
- snowflake/ml/modeling/preprocessing/polynomial_features.py +61 -21
- snowflake/ml/modeling/semi_supervised/label_propagation.py +61 -21
- snowflake/ml/modeling/semi_supervised/label_spreading.py +61 -21
- snowflake/ml/modeling/svm/linear_svc.py +61 -21
- snowflake/ml/modeling/svm/linear_svr.py +61 -21
- snowflake/ml/modeling/svm/nu_svc.py +61 -21
- snowflake/ml/modeling/svm/nu_svr.py +61 -21
- snowflake/ml/modeling/svm/svc.py +61 -21
- snowflake/ml/modeling/svm/svr.py +61 -21
- snowflake/ml/modeling/tree/decision_tree_classifier.py +61 -21
- snowflake/ml/modeling/tree/decision_tree_regressor.py +61 -21
- snowflake/ml/modeling/tree/extra_tree_classifier.py +61 -21
- snowflake/ml/modeling/tree/extra_tree_regressor.py +61 -21
- snowflake/ml/modeling/xgboost/xgb_classifier.py +64 -23
- snowflake/ml/modeling/xgboost/xgb_regressor.py +64 -23
- snowflake/ml/modeling/xgboost/xgbrf_classifier.py +64 -23
- snowflake/ml/modeling/xgboost/xgbrf_regressor.py +64 -23
- snowflake/ml/monitoring/_client/model_monitor.py +126 -0
- snowflake/ml/monitoring/_client/model_monitor_manager.py +361 -0
- snowflake/ml/monitoring/_client/model_monitor_version.py +1 -0
- snowflake/ml/monitoring/_client/monitor_sql_client.py +1335 -0
- snowflake/ml/monitoring/_client/queries/record_count.ssql +14 -0
- snowflake/ml/monitoring/_client/queries/rmse.ssql +28 -0
- snowflake/ml/monitoring/entities/model_monitor_config.py +28 -0
- snowflake/ml/monitoring/entities/model_monitor_interval.py +46 -0
- snowflake/ml/monitoring/entities/output_score_type.py +90 -0
- snowflake/ml/registry/_manager/model_manager.py +4 -0
- snowflake/ml/registry/registry.py +166 -8
- snowflake/ml/version.py +1 -1
- {snowflake_ml_python-1.6.1.dist-info → snowflake_ml_python-1.6.3.dist-info}/METADATA +43 -9
- snowflake_ml_python-1.6.3.dist-info/RECORD +400 -0
- {snowflake_ml_python-1.6.1.dist-info → snowflake_ml_python-1.6.3.dist-info}/WHEEL +1 -1
- snowflake/ml/_internal/container_services/image_registry/credential.py +0 -84
- snowflake/ml/_internal/container_services/image_registry/http_client.py +0 -127
- snowflake/ml/_internal/container_services/image_registry/imagelib.py +0 -400
- snowflake/ml/_internal/container_services/image_registry/registry_client.py +0 -212
- snowflake/ml/_internal/utils/log_stream_processor.py +0 -30
- snowflake/ml/_internal/utils/session_token_manager.py +0 -46
- snowflake/ml/_internal/utils/spcs_attribution_utils.py +0 -122
- snowflake/ml/_internal/utils/uri.py +0 -77
- snowflake/ml/data/torch_dataset.py +0 -33
- snowflake/ml/model/_api.py +0 -568
- snowflake/ml/model/_deploy_client/image_builds/base_image_builder.py +0 -12
- snowflake/ml/model/_deploy_client/image_builds/client_image_builder.py +0 -249
- snowflake/ml/model/_deploy_client/image_builds/docker_context.py +0 -130
- snowflake/ml/model/_deploy_client/image_builds/gunicorn_run.sh +0 -36
- snowflake/ml/model/_deploy_client/image_builds/inference_server/main.py +0 -268
- snowflake/ml/model/_deploy_client/image_builds/server_image_builder.py +0 -215
- snowflake/ml/model/_deploy_client/image_builds/templates/dockerfile_template +0 -53
- snowflake/ml/model/_deploy_client/image_builds/templates/image_build_job_spec_template +0 -38
- snowflake/ml/model/_deploy_client/image_builds/templates/kaniko_shell_script_template +0 -105
- snowflake/ml/model/_deploy_client/snowservice/deploy.py +0 -611
- snowflake/ml/model/_deploy_client/snowservice/deploy_options.py +0 -116
- snowflake/ml/model/_deploy_client/snowservice/instance_types.py +0 -10
- snowflake/ml/model/_deploy_client/snowservice/templates/service_spec_template +0 -28
- snowflake/ml/model/_deploy_client/snowservice/templates/service_spec_template_with_model +0 -21
- snowflake/ml/model/_deploy_client/utils/constants.py +0 -48
- snowflake/ml/model/_deploy_client/utils/snowservice_client.py +0 -280
- snowflake/ml/model/_deploy_client/warehouse/deploy.py +0 -202
- snowflake/ml/model/_deploy_client/warehouse/infer_template.py +0 -99
- snowflake/ml/model/_packager/model_handlers/llm.py +0 -267
- snowflake/ml/model/_packager/model_meta/_core_requirements.py +0 -11
- snowflake/ml/model/deploy_platforms.py +0 -6
- snowflake/ml/model/models/llm.py +0 -104
- snowflake/ml/monitoring/monitor.py +0 -203
- snowflake/ml/registry/_initial_schema.py +0 -142
- snowflake/ml/registry/_schema.py +0 -82
- snowflake/ml/registry/_schema_upgrade_plans.py +0 -116
- snowflake/ml/registry/_schema_version_manager.py +0 -163
- snowflake/ml/registry/model_registry.py +0 -2048
- snowflake_ml_python-1.6.1.dist-info/RECORD +0 -422
- {snowflake_ml_python-1.6.1.dist-info → snowflake_ml_python-1.6.3.dist-info}/LICENSE.txt +0 -0
- {snowflake_ml_python-1.6.1.dist-info → snowflake_ml_python-1.6.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
CREATE OR REPLACE FUNCTION ${MODEL_MONITOR_NAME}_PREDICTION_COUNT()
|
2
|
+
RETURNS TABLE(event_timestamp TIMESTAMP_NTZ, count FLOAT)
|
3
|
+
AS
|
4
|
+
$$$$
|
5
|
+
SELECT
|
6
|
+
time_slice(timestamp, 1, 'hour') as "event_timestamp",
|
7
|
+
sum(get($OUTPUT_COLUMN_NAME,'count')) as count
|
8
|
+
from
|
9
|
+
$MONITORING_TABLE
|
10
|
+
group by
|
11
|
+
1
|
12
|
+
order by
|
13
|
+
1 desc
|
14
|
+
$$$$;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
CREATE OR REPLACE FUNCTION ${MODEL_MONITOR_NAME}_RMSE()
|
2
|
+
RETURNS TABLE(event_timestamp TIMESTAMP_NTZ, value FLOAT)
|
3
|
+
AS
|
4
|
+
$$$$
|
5
|
+
WITH metric_of_interest as (
|
6
|
+
select
|
7
|
+
time_slice(timestamp, 1, 'hour') as event_timestamp,
|
8
|
+
AGGREGATE_METRICS:"sum_difference_squares_label_pred" as aggregate_field,
|
9
|
+
AGGREGATE_METRICS:"count" as "count"
|
10
|
+
from
|
11
|
+
$MONITORING_PRED_LABEL_JOINED_TABLE
|
12
|
+
), metric_combine as (
|
13
|
+
select
|
14
|
+
event_timestamp,
|
15
|
+
CAST(SUM(NVL(aggregate_field, 0)) as DOUBLE) as metric_sum,
|
16
|
+
SUM("count") as metric_count
|
17
|
+
from
|
18
|
+
metric_of_interest
|
19
|
+
where
|
20
|
+
cast(aggregate_field as varchar) not in ('inf','-inf','NaN')
|
21
|
+
group by
|
22
|
+
1
|
23
|
+
) select
|
24
|
+
event_timestamp,
|
25
|
+
SQRT(DIV0(metric_sum,metric_count)) as VALUE
|
26
|
+
from metric_combine
|
27
|
+
order by 1 desc
|
28
|
+
$$$$;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import List
|
3
|
+
|
4
|
+
from snowflake.ml.model._client.model import model_version_impl
|
5
|
+
from snowflake.ml.monitoring.entities import model_monitor_interval
|
6
|
+
|
7
|
+
|
8
|
+
@dataclass
|
9
|
+
class ModelMonitorTableConfig:
|
10
|
+
source_table: str
|
11
|
+
timestamp_column: str
|
12
|
+
prediction_columns: List[str]
|
13
|
+
label_columns: List[str]
|
14
|
+
id_columns: List[str]
|
15
|
+
|
16
|
+
|
17
|
+
@dataclass
|
18
|
+
class ModelMonitorConfig:
|
19
|
+
model_version: model_version_impl.ModelVersion
|
20
|
+
|
21
|
+
# Python model function name
|
22
|
+
model_function_name: str
|
23
|
+
background_compute_warehouse_name: str
|
24
|
+
# TODO: Add support for pythonic notion of time.
|
25
|
+
refresh_interval: str = model_monitor_interval.ModelMonitorRefreshInterval.DAILY
|
26
|
+
aggregation_window: model_monitor_interval.ModelMonitorAggregationWindow = (
|
27
|
+
model_monitor_interval.ModelMonitorAggregationWindow.WINDOW_1_DAY
|
28
|
+
)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
from enum import Enum
|
2
|
+
|
3
|
+
|
4
|
+
class ModelMonitorAggregationWindow(Enum):
|
5
|
+
WINDOW_1_HOUR = 60
|
6
|
+
WINDOW_1_DAY = 24 * 60
|
7
|
+
|
8
|
+
def __init__(self, minutes: int) -> None:
|
9
|
+
super().__init__()
|
10
|
+
self.minutes = minutes
|
11
|
+
|
12
|
+
|
13
|
+
class ModelMonitorRefreshInterval:
|
14
|
+
EVERY_30_MINUTES = "30 minutes"
|
15
|
+
HOURLY = "1 hours"
|
16
|
+
EVERY_6_HOURS = "6 hours"
|
17
|
+
EVERY_12_HOURS = "12 hours"
|
18
|
+
DAILY = "1 days"
|
19
|
+
WEEKLY = "7 days"
|
20
|
+
BIWEEKLY = "14 days"
|
21
|
+
MONTHLY = "30 days"
|
22
|
+
|
23
|
+
_ALLOWED_TIME_UNITS = {"minutes": 1, "hours": 60, "days": 24 * 60}
|
24
|
+
|
25
|
+
def __init__(self, raw_time_str: str) -> None:
|
26
|
+
try:
|
27
|
+
num_units_raw, time_units = raw_time_str.strip().split(" ")
|
28
|
+
num_units = int(num_units_raw) # try to cast
|
29
|
+
except Exception as e:
|
30
|
+
raise ValueError(
|
31
|
+
f"""Failed to parse refresh interval with exception {e}.
|
32
|
+
Provide '<num> <minutes | hours | days>'.
|
33
|
+
See https://docs.snowflake.com/en/sql-reference/sql/create-dynamic-table#required-parameters for more info."""
|
34
|
+
)
|
35
|
+
if time_units.lower() not in self._ALLOWED_TIME_UNITS:
|
36
|
+
raise ValueError(
|
37
|
+
"""Invalid time unit in refresh interval. Provide '<num> <minutes | hours | days>'.
|
38
|
+
See https://docs.snowflake.com/en/sql-reference/sql/create-dynamic-table#required-parameters for more info."""
|
39
|
+
)
|
40
|
+
minutes_multiplier = self._ALLOWED_TIME_UNITS[time_units.lower()]
|
41
|
+
self.minutes = num_units * minutes_multiplier
|
42
|
+
|
43
|
+
def __eq__(self, value: object) -> bool:
|
44
|
+
if not isinstance(value, ModelMonitorRefreshInterval):
|
45
|
+
return False
|
46
|
+
return self.minutes == value.minutes
|
@@ -0,0 +1,90 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from enum import Enum
|
4
|
+
from typing import List, Mapping
|
5
|
+
|
6
|
+
from snowflake.ml._internal.utils import sql_identifier
|
7
|
+
from snowflake.ml.model import type_hints
|
8
|
+
from snowflake.snowpark import types
|
9
|
+
|
10
|
+
# Accepted data types for each OutputScoreType.
|
11
|
+
REGRESSION_DATA_TYPES = (
|
12
|
+
types.ByteType,
|
13
|
+
types.ShortType,
|
14
|
+
types.IntegerType,
|
15
|
+
types.LongType,
|
16
|
+
types.FloatType,
|
17
|
+
types.DoubleType,
|
18
|
+
types.DecimalType,
|
19
|
+
)
|
20
|
+
CLASSIFICATION_DATA_TYPES = (
|
21
|
+
types.ByteType,
|
22
|
+
types.ShortType,
|
23
|
+
types.IntegerType,
|
24
|
+
types.BooleanType,
|
25
|
+
types.BinaryType,
|
26
|
+
)
|
27
|
+
PROBITS_DATA_TYPES = (
|
28
|
+
types.ByteType,
|
29
|
+
types.ShortType,
|
30
|
+
types.IntegerType,
|
31
|
+
types.LongType,
|
32
|
+
types.FloatType,
|
33
|
+
types.DoubleType,
|
34
|
+
types.DecimalType,
|
35
|
+
)
|
36
|
+
|
37
|
+
|
38
|
+
# OutputScoreType enum
|
39
|
+
class OutputScoreType(Enum):
|
40
|
+
UNKNOWN = "UNKNOWN"
|
41
|
+
REGRESSION = "REGRESSION"
|
42
|
+
CLASSIFICATION = "CLASSIFICATION"
|
43
|
+
PROBITS = "PROBITS"
|
44
|
+
|
45
|
+
@classmethod
|
46
|
+
def deduce_score_type(
|
47
|
+
cls,
|
48
|
+
table_schema: Mapping[str, types.DataType],
|
49
|
+
prediction_columns: List[sql_identifier.SqlIdentifier],
|
50
|
+
task: type_hints.Task,
|
51
|
+
) -> OutputScoreType:
|
52
|
+
"""Find the score type for monitoring given a table schema and the task.
|
53
|
+
|
54
|
+
Args:
|
55
|
+
table_schema: Dictionary of column names and types in the source table.
|
56
|
+
prediction_columns: List of prediction columns.
|
57
|
+
task: Enum value for the task of the model.
|
58
|
+
|
59
|
+
Returns:
|
60
|
+
Enum value for the score type, informing monitoring table set up.
|
61
|
+
|
62
|
+
Raises:
|
63
|
+
ValueError: If prediction type fails to align with task.
|
64
|
+
"""
|
65
|
+
# Already validated we have just one prediction column type
|
66
|
+
prediction_column_type = {table_schema[column_name] for column_name in prediction_columns}.pop()
|
67
|
+
|
68
|
+
if task == type_hints.Task.TABULAR_REGRESSION:
|
69
|
+
if isinstance(prediction_column_type, REGRESSION_DATA_TYPES):
|
70
|
+
return OutputScoreType.REGRESSION
|
71
|
+
else:
|
72
|
+
raise ValueError(
|
73
|
+
f"Expected prediction column type to be one of {REGRESSION_DATA_TYPES} "
|
74
|
+
f"for REGRESSION task. Found: {prediction_column_type}."
|
75
|
+
)
|
76
|
+
|
77
|
+
elif task == type_hints.Task.TABULAR_BINARY_CLASSIFICATION:
|
78
|
+
if isinstance(prediction_column_type, CLASSIFICATION_DATA_TYPES):
|
79
|
+
return OutputScoreType.CLASSIFICATION
|
80
|
+
elif isinstance(prediction_column_type, PROBITS_DATA_TYPES):
|
81
|
+
return OutputScoreType.PROBITS
|
82
|
+
else:
|
83
|
+
raise ValueError(
|
84
|
+
f"Expected prediction column type to be one of {CLASSIFICATION_DATA_TYPES} "
|
85
|
+
f"or one of {PROBITS_DATA_TYPES} for CLASSIFICATION task. "
|
86
|
+
f"Found: {prediction_column_type}."
|
87
|
+
)
|
88
|
+
|
89
|
+
else:
|
90
|
+
raise ValueError(f"Received unsupported task for model monitoring: {task}.")
|
@@ -50,6 +50,7 @@ class ModelManager:
|
|
50
50
|
sample_input_data: Optional[model_types.SupportedDataType] = None,
|
51
51
|
code_paths: Optional[List[str]] = None,
|
52
52
|
ext_modules: Optional[List[ModuleType]] = None,
|
53
|
+
task: model_types.Task = model_types.Task.UNKNOWN,
|
53
54
|
options: Optional[model_types.ModelSaveOption] = None,
|
54
55
|
statement_params: Optional[Dict[str, Any]] = None,
|
55
56
|
) -> model_version_impl.ModelVersion:
|
@@ -89,6 +90,7 @@ class ModelManager:
|
|
89
90
|
sample_input_data=sample_input_data,
|
90
91
|
code_paths=code_paths,
|
91
92
|
ext_modules=ext_modules,
|
93
|
+
task=task,
|
92
94
|
options=options,
|
93
95
|
statement_params=statement_params,
|
94
96
|
)
|
@@ -108,6 +110,7 @@ class ModelManager:
|
|
108
110
|
sample_input_data: Optional[model_types.SupportedDataType] = None,
|
109
111
|
code_paths: Optional[List[str]] = None,
|
110
112
|
ext_modules: Optional[List[ModuleType]] = None,
|
113
|
+
task: model_types.Task = model_types.Task.UNKNOWN,
|
111
114
|
options: Optional[model_types.ModelSaveOption] = None,
|
112
115
|
statement_params: Optional[Dict[str, Any]] = None,
|
113
116
|
) -> model_version_impl.ModelVersion:
|
@@ -156,6 +159,7 @@ class ModelManager:
|
|
156
159
|
code_paths=code_paths,
|
157
160
|
ext_modules=ext_modules,
|
158
161
|
options=options,
|
162
|
+
task=task,
|
159
163
|
)
|
160
164
|
statement_params = telemetry.add_statement_params_custom_tags(
|
161
165
|
statement_params, model_metadata.telemetry_metadata()
|
@@ -4,6 +4,7 @@ from typing import Any, Dict, List, Optional, Union, overload
|
|
4
4
|
|
5
5
|
import pandas as pd
|
6
6
|
|
7
|
+
from snowflake import snowpark
|
7
8
|
from snowflake.ml._internal import telemetry
|
8
9
|
from snowflake.ml._internal.utils import sql_identifier
|
9
10
|
from snowflake.ml.model import (
|
@@ -12,6 +13,13 @@ from snowflake.ml.model import (
|
|
12
13
|
model_signature,
|
13
14
|
type_hints as model_types,
|
14
15
|
)
|
16
|
+
from snowflake.ml.model._client.model import model_version_impl
|
17
|
+
from snowflake.ml.monitoring._client import (
|
18
|
+
model_monitor,
|
19
|
+
model_monitor_manager,
|
20
|
+
model_monitor_version,
|
21
|
+
)
|
22
|
+
from snowflake.ml.monitoring.entities import model_monitor_config
|
15
23
|
from snowflake.ml.registry._manager import model_manager
|
16
24
|
from snowflake.snowpark import session
|
17
25
|
|
@@ -26,6 +34,7 @@ class Registry:
|
|
26
34
|
*,
|
27
35
|
database_name: Optional[str] = None,
|
28
36
|
schema_name: Optional[str] = None,
|
37
|
+
options: Optional[Dict[str, Any]] = None,
|
29
38
|
) -> None:
|
30
39
|
"""Opens a registry within a pre-created Snowflake schema.
|
31
40
|
|
@@ -35,6 +44,9 @@ class Registry:
|
|
35
44
|
will be used. Defaults to None.
|
36
45
|
schema_name: The name of the schema. If None, the current schema of the session
|
37
46
|
will be used. If there is no active schema, the PUBLIC schema will be used. Defaults to None.
|
47
|
+
options: Optional set of configurations to modify registry.
|
48
|
+
Registry Options include:
|
49
|
+
- enable_monitoring: Feature flag to indicate whether registry can be used for monitoring.
|
38
50
|
|
39
51
|
Raises:
|
40
52
|
ValueError: When there is no specified or active database in the session.
|
@@ -64,6 +76,21 @@ class Registry:
|
|
64
76
|
session, database_name=self._database_name, schema_name=self._schema_name
|
65
77
|
)
|
66
78
|
|
79
|
+
self.enable_monitoring = options.get("enable_monitoring", False) if options else False
|
80
|
+
if self.enable_monitoring:
|
81
|
+
monitor_statement_params = telemetry.get_statement_params(
|
82
|
+
project=telemetry.TelemetryProject.MLOPS.value,
|
83
|
+
subproject=telemetry.TelemetrySubProject.MONITORING.value,
|
84
|
+
)
|
85
|
+
|
86
|
+
self._model_monitor_manager = model_monitor_manager.ModelMonitorManager(
|
87
|
+
session=session,
|
88
|
+
database_name=self._database_name,
|
89
|
+
schema_name=self._schema_name,
|
90
|
+
create_if_not_exists=True, # TODO: Support static setup method to configure schema for monitoring.
|
91
|
+
statement_params=monitor_statement_params,
|
92
|
+
)
|
93
|
+
|
67
94
|
@property
|
68
95
|
def location(self) -> str:
|
69
96
|
"""Get the location (database.schema) of the registry."""
|
@@ -93,7 +120,7 @@ class Registry:
|
|
93
120
|
Args:
|
94
121
|
model: Model object of supported types such as Scikit-learn, XGBoost, LightGBM, Snowpark ML,
|
95
122
|
PyTorch, TorchScript, Tensorflow, Tensorflow Keras, MLFlow, HuggingFace Pipeline,
|
96
|
-
Sentence Transformers,
|
123
|
+
Sentence Transformers, or Custom Model.
|
97
124
|
model_name: Name to identify the model.
|
98
125
|
version_name: Version identifier for the model. Combination of model_name and version_name must be unique.
|
99
126
|
If not specified, a random name will be generated.
|
@@ -119,8 +146,8 @@ class Registry:
|
|
119
146
|
- embed_local_ml_library: Embed local Snowpark ML into the code directory or folder.
|
120
147
|
Override to True if the local Snowpark ML version is not available in the Snowflake Anaconda
|
121
148
|
Channel. Otherwise, defaults to False
|
122
|
-
- relax_version: Whether or not relax the version constraints of the dependencies
|
123
|
-
It detects any ==x.y.z in specifiers and replaced with >=x.y, <(x+1). Defaults to True.
|
149
|
+
- relax_version: Whether or not relax the version constraints of the dependencies when running in the
|
150
|
+
Warehouse. It detects any ==x.y.z in specifiers and replaced with >=x.y, <(x+1). Defaults to True.
|
124
151
|
- function_type: Set the method function type globally. To set method function types individually see
|
125
152
|
function_type in model_options.
|
126
153
|
- method_options: Per-method saving options including:
|
@@ -182,6 +209,7 @@ class Registry:
|
|
182
209
|
sample_input_data: Optional[model_types.SupportedDataType] = None,
|
183
210
|
code_paths: Optional[List[str]] = None,
|
184
211
|
ext_modules: Optional[List[ModuleType]] = None,
|
212
|
+
task: model_types.Task = model_types.Task.UNKNOWN,
|
185
213
|
options: Optional[model_types.ModelSaveOption] = None,
|
186
214
|
) -> ModelVersion:
|
187
215
|
"""
|
@@ -191,7 +219,7 @@ class Registry:
|
|
191
219
|
model: Supported model or ModelVersion object.
|
192
220
|
- Supported model: Model object of supported types such as Scikit-learn, XGBoost, LightGBM, Snowpark ML,
|
193
221
|
PyTorch, TorchScript, Tensorflow, Tensorflow Keras, MLFlow, HuggingFace Pipeline, Sentence Transformers,
|
194
|
-
|
222
|
+
or Custom Model.
|
195
223
|
- ModelVersion: Source ModelVersion object used to create the new ModelVersion object.
|
196
224
|
model_name: Name to identify the model.
|
197
225
|
version_name: Version identifier for the model. Combination of model_name and version_name must be unique.
|
@@ -213,6 +241,9 @@ class Registry:
|
|
213
241
|
ext_modules: List of external modules to pickle with the model object.
|
214
242
|
Only supported when logging the following types of model:
|
215
243
|
Scikit-learn, Snowpark ML, PyTorch, TorchScript and Custom Model. Defaults to None.
|
244
|
+
task: The task of the Model Version. It is an enum class Task with values TABULAR_REGRESSION,
|
245
|
+
TABULAR_BINARY_CLASSIFICATION, TABULAR_MULTI_CLASSIFICATION, TABULAR_RANKING, or UNKNOWN. By default,
|
246
|
+
it is set to Task.UNKNOWN and may be overridden by inferring from the Model Object.
|
216
247
|
options (Dict[str, Any], optional): Additional model saving options.
|
217
248
|
|
218
249
|
Model Saving Options include:
|
@@ -220,8 +251,8 @@ class Registry:
|
|
220
251
|
- embed_local_ml_library: Embed local Snowpark ML into the code directory or folder.
|
221
252
|
Override to True if the local Snowpark ML version is not available in the Snowflake Anaconda
|
222
253
|
Channel. Otherwise, defaults to False
|
223
|
-
- relax_version: Whether or not relax the version constraints of the dependencies
|
224
|
-
It detects any ==x.y.z in specifiers and replaced with >=x.y, <(x+1). Defaults to True.
|
254
|
+
- relax_version: Whether or not relax the version constraints of the dependencies when running in the
|
255
|
+
Warehouse. It detects any ==x.y.z in specifiers and replaced with >=x.y, <(x+1). Defaults to True.
|
225
256
|
- function_type: Set the method function type globally. To set method function types individually see
|
226
257
|
function_type in model_options.
|
227
258
|
- method_options: Per-method saving options including:
|
@@ -244,8 +275,7 @@ class Registry:
|
|
244
275
|
warnings.warn(
|
245
276
|
"Models logged specifying `pip_requirements` can not be executed "
|
246
277
|
"in Snowflake Warehouse where all dependencies are required to be retrieved "
|
247
|
-
"from Snowflake Anaconda Channel.
|
248
|
-
"to log model with pip dependencies.",
|
278
|
+
"from Snowflake Anaconda Channel.",
|
249
279
|
category=UserWarning,
|
250
280
|
stacklevel=1,
|
251
281
|
)
|
@@ -262,6 +292,7 @@ class Registry:
|
|
262
292
|
sample_input_data=sample_input_data,
|
263
293
|
code_paths=code_paths,
|
264
294
|
ext_modules=ext_modules,
|
295
|
+
task=task,
|
265
296
|
options=options,
|
266
297
|
statement_params=statement_params,
|
267
298
|
)
|
@@ -334,3 +365,130 @@ class Registry:
|
|
334
365
|
)
|
335
366
|
|
336
367
|
self._model_manager.delete_model(model_name=model_name, statement_params=statement_params)
|
368
|
+
|
369
|
+
@telemetry.send_api_usage_telemetry(
|
370
|
+
project=telemetry.TelemetryProject.MLOPS.value,
|
371
|
+
subproject=telemetry.TelemetrySubProject.MONITORING.value,
|
372
|
+
)
|
373
|
+
@snowpark._internal.utils.private_preview(version=model_monitor_version.SNOWFLAKE_ML_MONITORING_MIN_VERSION)
|
374
|
+
def add_monitor(
|
375
|
+
self,
|
376
|
+
name: str,
|
377
|
+
table_config: model_monitor_config.ModelMonitorTableConfig,
|
378
|
+
model_monitor_config: model_monitor_config.ModelMonitorConfig,
|
379
|
+
*,
|
380
|
+
add_dashboard_udtfs: bool = False,
|
381
|
+
) -> model_monitor.ModelMonitor:
|
382
|
+
"""Add a Model Monitor to the Registry
|
383
|
+
|
384
|
+
Args:
|
385
|
+
name: Name of Model Monitor to create
|
386
|
+
table_config: Configuration options of table for ModelMonitor.
|
387
|
+
model_monitor_config: Configuration options of ModelMonitor.
|
388
|
+
add_dashboard_udtfs: Add UDTFs useful for creating a dashboard.
|
389
|
+
|
390
|
+
Returns:
|
391
|
+
The newly added ModelMonitor object.
|
392
|
+
|
393
|
+
Raises:
|
394
|
+
ValueError: If monitoring feature flag is not enabled.
|
395
|
+
"""
|
396
|
+
if not self.enable_monitoring:
|
397
|
+
raise ValueError(
|
398
|
+
"Must enable monitoring in Registry to use this method. Please set the `enable_monitoring=True` option"
|
399
|
+
)
|
400
|
+
|
401
|
+
# TODO: Change to fully qualified source table reference to allow table to live in different DB.
|
402
|
+
return self._model_monitor_manager.add_monitor(
|
403
|
+
name, table_config, model_monitor_config, add_dashboard_udtfs=add_dashboard_udtfs
|
404
|
+
)
|
405
|
+
|
406
|
+
@overload
|
407
|
+
def get_monitor(self, model_version: model_version_impl.ModelVersion) -> model_monitor.ModelMonitor:
|
408
|
+
"""Get a Model Monitor on a ModelVersion from the Registry
|
409
|
+
|
410
|
+
Args:
|
411
|
+
model_version: ModelVersion for which to retrieve the ModelMonitor.
|
412
|
+
"""
|
413
|
+
...
|
414
|
+
|
415
|
+
@overload
|
416
|
+
def get_monitor(self, name: str) -> model_monitor.ModelMonitor:
|
417
|
+
"""Get a Model Monitor from the Registry
|
418
|
+
|
419
|
+
Args:
|
420
|
+
name: Name of Model Monitor to retrieve.
|
421
|
+
"""
|
422
|
+
...
|
423
|
+
|
424
|
+
@telemetry.send_api_usage_telemetry(
|
425
|
+
project=telemetry.TelemetryProject.MLOPS.value,
|
426
|
+
subproject=telemetry.TelemetrySubProject.MONITORING.value,
|
427
|
+
)
|
428
|
+
@snowpark._internal.utils.private_preview(version=model_monitor_version.SNOWFLAKE_ML_MONITORING_MIN_VERSION)
|
429
|
+
def get_monitor(
|
430
|
+
self, *, name: Optional[str] = None, model_version: Optional[model_version_impl.ModelVersion] = None
|
431
|
+
) -> model_monitor.ModelMonitor:
|
432
|
+
"""Get a Model Monitor from the Registry
|
433
|
+
|
434
|
+
Args:
|
435
|
+
name: Name of Model Monitor to retrieve.
|
436
|
+
model_version: ModelVersion for which to retrieve the ModelMonitor.
|
437
|
+
|
438
|
+
Returns:
|
439
|
+
The fetched ModelMonitor.
|
440
|
+
|
441
|
+
Raises:
|
442
|
+
ValueError: If monitoring feature flag is not enabled.
|
443
|
+
ValueError: If neither name nor model_version specified.
|
444
|
+
"""
|
445
|
+
if not self.enable_monitoring:
|
446
|
+
raise ValueError(
|
447
|
+
"Must enable monitoring in Registry to use this method. Please set the `enable_monitoring=True` option"
|
448
|
+
)
|
449
|
+
if name is not None:
|
450
|
+
return self._model_monitor_manager.get_monitor(name=name)
|
451
|
+
elif model_version is not None:
|
452
|
+
return self._model_monitor_manager.get_monitor_by_model_version(model_version=model_version)
|
453
|
+
else:
|
454
|
+
raise ValueError("Must provide either `name` or `model_version` to get ModelMonitor")
|
455
|
+
|
456
|
+
@telemetry.send_api_usage_telemetry(
|
457
|
+
project=telemetry.TelemetryProject.MLOPS.value,
|
458
|
+
subproject=telemetry.TelemetrySubProject.MONITORING.value,
|
459
|
+
)
|
460
|
+
@snowpark._internal.utils.private_preview(version=model_monitor_version.SNOWFLAKE_ML_MONITORING_MIN_VERSION)
|
461
|
+
def show_model_monitors(self) -> List[snowpark.Row]:
|
462
|
+
"""Show all model monitors in the registry.
|
463
|
+
|
464
|
+
Returns:
|
465
|
+
List of snowpark.Row containing metadata for each model monitor.
|
466
|
+
|
467
|
+
Raises:
|
468
|
+
ValueError: If monitoring feature flag is not enabled.
|
469
|
+
"""
|
470
|
+
if not self.enable_monitoring:
|
471
|
+
raise ValueError(
|
472
|
+
"Must enable monitoring in Registry to use this method. Please set the `enable_monitoring=True` option"
|
473
|
+
)
|
474
|
+
return self._model_monitor_manager.show_model_monitors()
|
475
|
+
|
476
|
+
@telemetry.send_api_usage_telemetry(
|
477
|
+
project=telemetry.TelemetryProject.MLOPS.value,
|
478
|
+
subproject=telemetry.TelemetrySubProject.MONITORING.value,
|
479
|
+
)
|
480
|
+
@snowpark._internal.utils.private_preview(version=model_monitor_version.SNOWFLAKE_ML_MONITORING_MIN_VERSION)
|
481
|
+
def delete_monitor(self, name: str) -> None:
|
482
|
+
"""Delete a Model Monitor from the Registry
|
483
|
+
|
484
|
+
Args:
|
485
|
+
name: Name of the Model Monitor to delete.
|
486
|
+
|
487
|
+
Raises:
|
488
|
+
ValueError: If monitoring feature flag is not enabled.
|
489
|
+
"""
|
490
|
+
if not self.enable_monitoring:
|
491
|
+
raise ValueError(
|
492
|
+
"Must enable monitoring in Registry to use this method. Please set the `enable_monitoring=True` option"
|
493
|
+
)
|
494
|
+
self._model_monitor_manager.delete_monitor(name)
|
snowflake/ml/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION="1.6.
|
1
|
+
VERSION="1.6.3"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: snowflake-ml-python
|
3
|
-
Version: 1.6.
|
3
|
+
Version: 1.6.3
|
4
4
|
Summary: The machine learning client library that is used for interacting with Snowflake to build machine learning solutions.
|
5
5
|
Author-email: "Snowflake, Inc" <support@snowflake.com>
|
6
6
|
License:
|
@@ -247,13 +247,13 @@ Requires-Dist: pytimeparse <2,>=1.1.8
|
|
247
247
|
Requires-Dist: pyyaml <7,>=6.0
|
248
248
|
Requires-Dist: retrying <2,>=1.3.3
|
249
249
|
Requires-Dist: s3fs <2024,>=2022.11
|
250
|
-
Requires-Dist: scikit-learn <1.
|
250
|
+
Requires-Dist: scikit-learn <1.6,>=1.2.1
|
251
251
|
Requires-Dist: scipy <2,>=1.9
|
252
252
|
Requires-Dist: snowflake-connector-python[pandas] <4,>=3.5.0
|
253
253
|
Requires-Dist: snowflake-snowpark-python <2,>=1.17.0
|
254
254
|
Requires-Dist: sqlparse <1,>=0.4
|
255
255
|
Requires-Dist: typing-extensions <5,>=4.1.0
|
256
|
-
Requires-Dist: xgboost <2,>=1.7.3
|
256
|
+
Requires-Dist: xgboost <2.1,>=1.7.3
|
257
257
|
Provides-Extra: all
|
258
258
|
Requires-Dist: catboost <2,>=1.2.0 ; extra == 'all'
|
259
259
|
Requires-Dist: lightgbm <5,>=3.3.5 ; extra == 'all'
|
@@ -261,7 +261,7 @@ Requires-Dist: mlflow <2.4,>=2.1.0 ; extra == 'all'
|
|
261
261
|
Requires-Dist: peft <1,>=0.5.0 ; extra == 'all'
|
262
262
|
Requires-Dist: sentence-transformers <3,>=2.2.2 ; extra == 'all'
|
263
263
|
Requires-Dist: sentencepiece <1,>=0.1.95 ; extra == 'all'
|
264
|
-
Requires-Dist: shap
|
264
|
+
Requires-Dist: shap <1,>=0.42.0 ; extra == 'all'
|
265
265
|
Requires-Dist: tensorflow <3,>=2.10 ; extra == 'all'
|
266
266
|
Requires-Dist: tokenizers <1,>=0.10 ; extra == 'all'
|
267
267
|
Requires-Dist: torch <2.3.0,>=2.0.1 ; extra == 'all'
|
@@ -276,7 +276,7 @@ Requires-Dist: peft <1,>=0.5.0 ; extra == 'llm'
|
|
276
276
|
Provides-Extra: mlflow
|
277
277
|
Requires-Dist: mlflow <2.4,>=2.1.0 ; extra == 'mlflow'
|
278
278
|
Provides-Extra: shap
|
279
|
-
Requires-Dist: shap
|
279
|
+
Requires-Dist: shap <1,>=0.42.0 ; extra == 'shap'
|
280
280
|
Provides-Extra: tensorflow
|
281
281
|
Requires-Dist: tensorflow <3,>=2.10 ; extra == 'tensorflow'
|
282
282
|
Provides-Extra: torch
|
@@ -373,7 +373,44 @@ be compatibility issues. Server-side functionality that `snowflake-ml-python` de
|
|
373
373
|
|
374
374
|
# Release History
|
375
375
|
|
376
|
-
## 1.6.
|
376
|
+
## 1.6.3
|
377
|
+
|
378
|
+
- Model Registry (PrPr) has been removed.
|
379
|
+
|
380
|
+
### Bug Fixes
|
381
|
+
|
382
|
+
- Registry: Fix a bug that when package whose name does not follow PEP-508 is provided when logging the model,
|
383
|
+
an unexpected normalization is happening.
|
384
|
+
- Registry: Fix `not a valid remote uri` error when logging mlflow models.
|
385
|
+
- Registry: Fix a bug that `ModelVersion.run` is called in a nested way.
|
386
|
+
- Registry: Fix an issue that leads to `log_model` failure when local package version contains parts other than
|
387
|
+
base version.
|
388
|
+
|
389
|
+
### New Features
|
390
|
+
|
391
|
+
- Data: Improve `DataConnector.to_pandas()` performance when loading from Snowpark DataFrames.
|
392
|
+
- Model Registry: Allow users to set a model task while using `log_model`.
|
393
|
+
- Feature Store: FeatureView supports ON_CREATE or ON_SCHEDULE initialize mode.
|
394
|
+
|
395
|
+
## 1.6.2 (2024-09-04)
|
396
|
+
|
397
|
+
### Bug Fixes
|
398
|
+
|
399
|
+
- Modeling: Support XGBoost version that is larger than 2.
|
400
|
+
|
401
|
+
- Data: Fix multiple epoch iteration over `DataConnector.to_torch_datapipe()` DataPipes.
|
402
|
+
- Generic: Fix a bug that when an invalid name is provided to argument where fully qualified name is expected, it will
|
403
|
+
be parsed wrongly. Now it raises an exception correctly.
|
404
|
+
- Model Explainability: Handle explanations for multiclass XGBoost classification models
|
405
|
+
- Model Explainability: Workarounds and better error handling for XGB>2.1.0 not working with SHAP==0.42.1
|
406
|
+
|
407
|
+
### New Features
|
408
|
+
|
409
|
+
- Data: Add top-level exports for `DataConnector` and `DataSource` to `snowflake.ml.data`.
|
410
|
+
- Data: Add native batching support via `batch_size` and `drop_last_batch` arguments to `DataConnector.to_torch_dataset()`
|
411
|
+
- Feature Store: update_feature_view() supports taking feature view object as argument.
|
412
|
+
|
413
|
+
## 1.6.1 (2024-08-12)
|
377
414
|
|
378
415
|
### Bug Fixes
|
379
416
|
|
@@ -390,14 +427,11 @@ be compatibility issues. Server-side functionality that `snowflake-ml-python` de
|
|
390
427
|
### New Features
|
391
428
|
|
392
429
|
- Enable `set_params` to set the parameters of the underlying sklearn estimator, if the snowflake-ml model has been fit.
|
393
|
-
- Data: Add top-level exports for `DataConnector` and `DataSource` to `snowflake.ml.data`.
|
394
430
|
- Data: Add `snowflake.ml.data.ingestor_utils` module with utility functions helpful for `DataIngestor` implementations.
|
395
431
|
- Data: Add new `to_torch_dataset()` connector to `DataConnector` to replace deprecated DataPipe.
|
396
432
|
- Registry: Option to `enable_explainability` set to True by default for XGBoost, LightGBM and CatBoost as PuPr feature.
|
397
433
|
- Registry: Option to `enable_explainability` when registering SHAP supported sklearn models.
|
398
434
|
|
399
|
-
### Behavior Changes
|
400
|
-
|
401
435
|
## 1.6.0 (2024-07-29)
|
402
436
|
|
403
437
|
### Bug Fixes
|