Advanced Momentum Trading Strategies Course:

In the XGBoost Model Notebook,

am getting the error 



ValueError: Invalid classes inferred from unique values of y.  Expected: [0 1], got [-1  1]



while running


Train the model using the training data

model.fit(X_train, y_train, eval_metric='logloss')



The target should be 1 & 0 right and not 1 & -1 right ?



The code in the notebook has :



target['signal'] = np.where(target['signal'] > 0, 1, -1)

 

Hi Sugat,



The notebook seems to be working fine on the portal and in the local environment after downloading the zip file from the last section of the course.



The target variables are 1 and -1, as they help us in deciding whether we should go long or short. If it was a long-only strategy, then the target variable would be 1 and 0. 



If you are running the notebook on the local system, there is a chance that you are using a different version of the XGBoost library. You can try installing XGBoost version 1.4.1 using the following command and then re-running the notebook. 

!pip install xgboost==1.4.1

Please let us know if you still face any issues.

Okay thanks Akhshay!