ColasGael / Machine-Learning-for-Solar-Energy-Prediction

Predict the Power Production of a solar panel farm from Weather Measurements using Machine Learning
MIT License
229 stars 105 forks source link

the data shape problem during adaboost #1

Closed joonv2 closed 5 years ago

joonv2 commented 5 years ago

hi, When I run your code, I have an error, expected adaboost.fit(train_data, train_labels) problem. I turn off the vanilla lstm model line and turn on adaboost model. Then the problem occurs . Expected 3 dimensions but got array with shape (,) I think the 3 dimension data shape put in the lstm layer, but the adaboost might need 2 dimension shape.

How can I do.? I know your changed code to apply adaboost model. plz.

adelekuzmiakova commented 5 years ago

Hi joonv2,

Thanks so much for trying out our code. Sincere apologies for the delay in addressing your question; I didn't check Gael's repository up until now. With that in mind, I don't recall we applied the AdaBoost classifier to our dataset. Could you please specify what script are your running and where the error occurs?

To try to address your question, I can't see shapes being the problem. If we were to apply the AdaBoost we would select all the relevant features, such as humidity, hour, could cover, month, etc that could help predict the response (solar output). In this case, the shape of the training data would be equal to the number of features. You can see a similar example here:

https://www.datacamp.com/community/tutorials/adaboost-classifier-python

where x_train has 4 features. So the number of features is entirely up to you and it doesn't have to be bounded by 2. Hope this helps :) and please let me know if you are still stuck on something

Best, -Adele

AIwalker1 commented 5 years ago

Hi, thanks for the above information and sharing the code.

But I still have the same question with joonv2. The question is when I run this 'rnn.py' file at this website: https://github.com/ColasGael/Machine-Learning-for-Solar-Energy-Prediction/tree/master/Recurrent%20Neural%20Network

with necessary 'csv' data copied from ‘https://github.com/ColasGael/Machine-Learning-for-Solar-Energy-Prediction/tree/master/Weighted%20Linear%20Regression’.

The error information is : File "rnn.py", line 242, in main() File "rnn.py", line 179, in main adaboost.fit(train_data, train_labels) File "C:\Users\yanyu\Anaconda3\envs\tensorflow\lib\site-packages\sklearn\ensemble\weight_boosting.py", line 412, in fit return super(AdaBoostClassifier, self).fit(X, y, sample_weight) File "C:\Users\yanyu\Anaconda3\envs\tensorflow\lib\site-packages\sklearn\ensemble\weight_boosting.py", line 128, in fit self._validate_estimator() File "C:\Users\yanyu\Anaconda3\envs\tensorflow\lib\site-packages\sklearn\ensemble\weight_boosting.py", line 428, in _validate_estimator if not has_fit_parameter(self.baseestimator, "sample_weight"): File "C:\Users\yanyu\Anaconda3\envs\tensorflow\lib\site-packages\sklearn\utils\validation.py", line 845, in has_fit_parameter return parameter in signature(estimator.fit).parameters AttributeError: 'function' object has no attribute 'fit'

Could you explain this? thanks.