Offline Predictions

Apart from make predictions online using “predict” button, you can also make predictions offline using downloaded models. The specific steps are as follows.

 

Download Model

Click the “Download model” button to download the model that has been trained by the task. At this time, a compressed file will be obtained, and the general content after decompression is as follows:

Pasted Image

Install Prediction Environment

Based on the conda/Anaconda environment, which is a tool for quickly installing the Python environment, you can run the following command to set up the prediction environment:

# Create a Python virtual environment

conda create -n changtian python==3.10 -y

# Activate virtual environment

conda activate changtian

# Install predictive frame dependencies

pip install changtianml -i https://pypi.tuna.tsinghua.edu.cn/simple/

Well done! The prediction environment is completed!

Model Prediction

At present, the platform has released the library “changtianml” in the Python public warehouse PyPI, which can be more portable and convenient for users to make predictions and other related work.

The model can be run by referring to the example.py sample file provided by the platform. The comments in the file explain the functions and basic usage of the library in detail. Please read it. Here is a piece of code for reference only:

# Import platform-related dependencies

from changtianml import tabular_incrml

 

# load the model in directory “res_path”

res_path = r'result'

ti = tabular_incrml(res_path)

 

# start the prediction using test data’s path

test_path = r'test_data.csv'

pred = ti.predict(test_path)

 

# Output prediction result

print(pred)

print(ti.predict_proba(test_path))