太騷了,用Excel玩機器學習! [m2cgen(Model 2 Code Generator)]

太騷了,用Excel玩機器學習! [m2cgen(Model 2 Code Generator)]

太騷了,用Excel玩機器學習! [m2cgen(Model 2 Code Generator)]



資料來源: https://mp.weixin.qq.com/s/iFbrewXZLilEFQjBv4NMng

https://github.com/tjxj/excel2ml



#pip install m2cgen

# import packages
import pandas as pd
import numpy as np
import os re
from random import sample
from sklearn import datasets
from xgboost import XGBClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
import pickle
import m2cgen as m2c

seed = 2020
test_size = 0.3
X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=test_size, random_state=seed)
# fit model on training data
model = XGBClassifier()
model.fit(X_train, y_train)


#將模型轉為VBA
code = m2c.export_to_visual_basic(model, function_name = 'pred')

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *