橙色 oython 脚本中的 SMOTE

问题描述

任何人都可以在 Orange 中共享 SMOTE 采样的代码 现在我正在使用它但不起作用

import Orange
import numpy as np
from Orange.data import Domain,Table
from imblearn.over_sampling import SMOTE

# How Orange passes data to widget
df = in_data.copy()

# set variables for SMOTE
sm = SMOTE(random_state=0)

# get table of data (X) and class variables (y)
X,y = df.X,df.Y


# resample data and classes
X_res,y_res = sm.fit_resample(X,y)

# Get the target and feature variables
d = Domain(df.domain.attributes,df.domain.class_vars)

# Create a new Orange Table object with the appropriate headers
# This is how Orange passes the data on to the next widget
out_data = Orange.data.Table(d,X_res,y_res)

我的班级是 Int ,我尝试调整但不起作用

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)