No real need to add values after performing train_test_split as the output is an array itself. Simply try with:
Xtrain = Xtrain.reshape(-1,1)
Xtest = Xtest.reshape(-1,1)
Answer from Celius Stingher on Stack OverflowAttributeError: 'numpy.ndarray' object has no attribute 'numpy'
Python Coding help- keep recieving error message"AttributeError: 'numpy.ndarray' object has no attribute 'MESSAGE_A'"
AttributeError: 'list' object has no attribute 'reshape'
python 2.7 - Tensorflow error using tf.image.random : 'numpy.ndarray' object has no attribute 'get_shape' - Stack Overflow
https://imgur.com/gallery/yAdAjdx
Hello,
Linked is the screenshot of the two error messages I keep recieving as well as the code leading up to it. I'm trying to run an uplift on a classification tree. Any help is appreciated, I am still fairly new to python. Thank you!!
It would be helpful if you could post the full stack trace, so that we can see which line your error occurs at. In general, the more information you can provide in a question, the better.
In this case, it looks like your full_model_pipeline may somehow become a numpy array. Since you have a one-element pipeline, you could try changing
full_model_pipeline = Pipeline(steps =[
('full_pipeline',full_pipeline),
('model',LinearRegression())
])
full_model_pipeline.fit(X_train,y_train)
to
model = LinearRegression()
model.fit(X_train, y_train)
I believe you need to add () where you add scaler to the pipeline: ('std_scaler',StandardScaler) --> ('std_scaler',StandardScaler())