igel:几行命令实现机器学习自学习

AI拉呱
4 min readOct 12, 2020

--

  • 安装
  • 实战
  • 初始化
  • 训练
  • 验证
  • 预测
  • 实例

自动学习igel

安装

  • pip install igel

igel支持的模型

实战

初始化

$ igel init -type "classification" -model "NeuralNetwork" -target "recurrence"
  • igel.yaml
dataset:
preprocess:
missing_values: mean
scale:
method: standard
target: inputs
split:
shuffle: true
test_size: 0.2
type: csv
model:
algorithm: NeuralNetwork
type: classification
target:
- recurrence

训练

$ igel fit -dp "../data/cryablation.csv" -yml "./igel.yml" -cmd "fit"

验证

$ igel evaluate -dp path_to_the_evaluation_dataset

预测

$ igel predict -dp path_to_the_new_dataset

实例

  • igel.yaml
# dataset operations
dataset:
split: # split options
test_size: 0.2 # 0.2 means 20% for the test data, so 80% are automatically for training
shuffle: True # whether to shuffle the data before/while splitting
stratify: default # If not None, data is split in a stratified fashion, using this as the class labels.
preprocess: # preprocessing options
missing_values: mean # other possible values: [drop, median, most_frequent, constant] check the docs for more
encoding:
type: labelEncoding # other possible values: [labelEncoding]
column: Species
scale: # scaling options
method: standard # standardization will scale values to have a 0 mean and 1 standard deviation | you can also try minmax
target: inputs # scale inputs. | other possible values: [outputs, all] # if you choose all then all values in the dataset will be scaled
# model definition
model:
type: classification
algorithm: LogisticRegression
# target you want to predict
target:
- Species
  • fit.py
from igel import Igel
mock_fit_params = {'data_path': '../iris/train-Iris.csv',
'yaml_path': './iris.yaml',
'cmd': 'fit'}
Igel(**mock_fit_params)
  • evaluate.py
from igel import Igel
mock_eval_params = {'data_path': '../iris/eval-Iris.csv',
'cmd': 'evaluate'}
Igel(**mock_eval_params)
  • predict.py
from igel import Igel
mock_pred_params = {'data_path': '../iris/test-Iris.csv',
'cmd': 'predict'}
Igel(**mock_pred_params)

参考:https://github.com/nidhaloff/igel

--

--

AI拉呱
AI拉呱

Written by AI拉呱

专注于人工智与网络安全方面的研究,现任资深算法研究员,兼职硕士研究生导师;热爱机器学习和深度学习算法应用,深耕大语言模型微调、量化、私域部署。曾获多次获得AI竞赛大奖,拥有多项发明专利和学术论文。对于AI算法有自己独特见解和经验。曾辅导十几位非计算机学生转行到算法岗位就业。

No responses yet