Machine Learning Modeling
Overview
Machine learning analyzes data through algorithms to perform classification and regression predictions, such as stock price forecasts, spam email classification, credit scoring, medical diagnosis, etc. We can use CodeInterpreter to produce such algorithmic code, model data, and complete prediction tasks.
Example: Wine Recognition
Task
We use the sklearn wine recognition dataset as an example to illustrate how to use CodeInterpreter for machine learning modeling. This is a classic multi-class dataset with several features such as color, chemical composition, etc., based on which the wine category of samples can be predicted. We require CodeInterpreter to fetch the data, split the training and validation sets, train the model, and make predictions on the validation set.
Code
python examples/ci/machine_learning.py
python examples/ci/machine_learning.py
Execution Results
Mechanism Explained
CodeInterpreter plans according to our requirements, forms several tasks, and executes them in sequence to fulfill the needs. The complete code generated by CodeInterpreter will be stored in the data/output path.
Extension
For targeted processing of more complex machine learning tasks, please refer to Machine Learning Engineer.