You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Tushar. Thanks for sharing the package. I am facing an issue with the line self.temp1 = XGBClassifier().fit(self.X, self.y).feature_importances_ in the method base_tree() of models.py. I can't get much out of the error which says:
UserWarning: The use of label encoder in XGBClassifier is deprecated and will be removed in a future release. To remove this warning, do the following: 1) Pass option use_label_encoder=False when constructing XGBClassifier object; and 2) Encode your labels (y) as integers starting with 0, i.e. 0, 1, 2, ..., [num_class - 1].
warnings.warn(label_encoder_deprecation_msg, UserWarning)
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
The surprising thing is that when I run XGBClassifier().fit(X, y) on the same data in an IPython console, it runs fine.
I am using the same script as provided in the README:
import torch
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from XBNet.training_utils import training,predict
from XBNet.models import XBNETClassifier
from XBNet.run import run_XBNET
# Experiment with Iris data directly from sklearn.
# iris = load_iris()
# data = pd.DataFrame(iris.data)
# data.columns = iris.feature_names
# data.loc[:, 'type'] = iris.target
# X, y = data.iloc[:, :-1], data.iloc[:, -1]
# X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=123)
data = pd.read_csv('test/Iris.csv')
print(data.shape)
x_data = data[data.columns[:-1]]
print(x_data.shape)
y_data = data[data.columns[-1]]
le = LabelEncoder()
y_data = np.array(le.fit_transform(y_data))
print(le.classes_)
X_train,X_test,y_train,y_test = train_test_split(x_data.to_numpy(),y_data,test_size = 0.3,random_state = 0)
model = XBNETClassifier(X_train,y_train,2)
criterion = torch.nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
m,acc, lo, val_ac, val_lo = run_XBNET(X_train,X_test,y_train,y_test,model,criterion,optimizer,32,300)
print(predict(m,x_data.to_numpy()[0,:]))
Any idea what could be going wrong here? Following are some details of my system that might be useful:
OS: macOS 11.5.2
Python 3.8.11
XGBoost version: 1.4.2
XBNet: 1.3.1
The text was updated successfully, but these errors were encountered:
Hi Tushar. Thanks for sharing the package. I am facing an issue with the line
self.temp1 = XGBClassifier().fit(self.X, self.y).feature_importances_
in the methodbase_tree()
ofmodels.py
. I can't get much out of the error which says:The surprising thing is that when I run
XGBClassifier().fit(X, y)
on the same data in an IPython console, it runs fine.I am using the same script as provided in the README:
Any idea what could be going wrong here? Following are some details of my system that might be useful:
The text was updated successfully, but these errors were encountered: