auger.ai.predict-1.0.98


توضیحات

Auger ML predict python and command line interface
ویژگی مقدار
سیستم عامل -
نام فایل auger.ai.predict-1.0.98
نام auger.ai.predict
نسخه کتابخانه 1.0.98
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Deep Learn, Inc.
ایمیل نویسنده augerai@dplrn.com
آدرس صفحه اصلی https://github.com/deeplearninc/auger-ai
آدرس اینترنتی https://pypi.org/project/auger.ai.predict/
مجوز Apache
# Install ``` pip install auger.ai.predict ``` # Auger.ai.predict Auger ML predict Python API and command line interface # Download exported model To download exported model you can use: - Auger.ai web : https://app.auger.ai - auger.ai command line interface: https://pypi.org/project/auger.ai/ # Predict using exported model - Unzip file with model - Run client.py from model folder: python <model_path>/client.py --path_to_predict <data_path> --model_path model_path --path_to_predict - path to file with data to predict. Should contain features used to train model --model_path - folder which contain model.pkl.gz file For example: python ./models/export_9BB0BFA3D368454/client.py --path_to_predict ./files/baseball_predict.csv --model_path ./models/export_9BB0BFA3D368454/model ## Client.py command line parameters --path_to_predict Path to file for predict --model_path Path to folder with model --threshold Threshold to use for calculate target using predict_proba --score 0/1 Build scores after prediction if prediction data contain actual target # Auger.ai.predict Python API ## auger_ml.model_exporter.ModelExporter ModelExporter provides interface to Auger predict API. - **ModelExporter(options)** - constructs ModelExporter instance. - options - optional parameters. Must be {} for now - **predict_by_model(model_path, path_to_predict=None, records=None, features=None, threshold=None)** - produce prediction based on exported model and data - model_path - folder which contain model.pkl.gz file - path_to_predict - data to predict - records - data to predict: list of lists. path_to_predict should be None in this case. For example: [[0.1,0.2],[0.1, 0.3]] - features - feature names for records. Used only when records is not None - threshold - set threshold to produce prediction for classification based on probabilities. proba_ column will be added to prediction result for each target class - RETURN: predictions - if path_to_predict is not None, then file in same directory with predcitions, or pandas dataframe Example: ``` def predict_by_model_example(path_to_predict=None, threshold=None, model_path=None): #features is an array mapping your data to the feature, your feature and data should be #the same that you trained your model with. #If it is None, features read from model/options.json file #['feature1', 'feature2'] features = None # data is an array of arrays to get predictions for, input your data below # each record should contain values for each feature records = [[],[]] if path_to_predict: path_to_predict=os.path.abspath(path_to_predict) predictions = ModelExporter({}).predict_by_model( records=records, model_path=model_path, path_to_predict=path_to_predict, features=features, threshold=threshold ) return predictions ``` - **load_model(model_path)** - load model from file. - model_path - folder which contain model.pkl.gz file - RETURN: model, timeseries_model - model - ML model to call predict - timeseries_model - flag is this timeseries model or not - **preprocess_data(model_path, data_path, records=None, features=None)** - preprocess data for predict. It will process data same way as train data used for model - model_path - folder which contain model.pkl.gz file - data_path - data to preprocess - records - data to predict: list of lists. data_path should be None in this case. For example: [[0.1,0.2],[0.1, 0.3]] - features - feature names for records. Used only when records is not None - RETURN: X_test, Y_test, target_categoricals - X_test - data to call predict - Y_test - array with target values - target_categoricals - dict with categories for target, may be used to get actual target values Example: ``` def predict_by_model_example(path_to_predict=None, model_path=None): model_exporter = ModelExporter({}) model, timeseries_model = model_exporter.load_model(model_path) X_test, Y_test, target_categoricals = model_exporter.preprocess_data(model_path, data_path=path_to_predict) results = model.predict(X_test) # If your target is categorical you can translate predicted values back to original: # target_feature = "target" # categories = target_categoricals[target_feature]['categories'] # results = map(lambda x: categories[int(x)], results) ``` Example for timeseries data: ``` def predict_by_model_timeseries_example(path_to_predict=None, model_path=None): model_exporter = ModelExporter({}) model, timeseries_model = model_exporter.load_model(model_path) X_test, Y_test, target_categoricals = model_exporter.preprocess_data(model_path, data_path=path_to_predict) if timeseries_model: results = model.predict((X_test, Y_test, False))[-1:] else: results = model.predict(X_test.iloc[-1:]) ```


نیازمندی

مقدار نام
==1.23.5 numpy
==1.5.0 pandas
==1.16.0 six
==1.9.1 scipy
==1.2.0 scikit-learn
==1.6.2 xgboost
<2.0,>1.0 catboost
<3.4,>3.3 lightgbm
- modAL
- joblib
- boto3
==0.4.2 s3fs
- stopit
==6.2.0 smart-open
==5.2.7 celery
==1.23.5 numpy
==1.5.0 pandas
==1.16.0 six
==1.9.1 scipy
==1.2.0 scikit-learn
==1.6.2 xgboost
- modAL
- joblib
- boto3
==0.4.2 s3fs
- stopit
==6.2.0 smart-open
==5.2.7 celery


زبان مورد نیاز

مقدار نام
>=3 Python


نحوه نصب


نصب پکیج whl auger.ai.predict-1.0.98:

    pip install auger.ai.predict-1.0.98.whl


نصب پکیج tar.gz auger.ai.predict-1.0.98:

    pip install auger.ai.predict-1.0.98.tar.gz