I have a dataset containing data on temperature, precipitation and soybean yields for a farm for 10 years (2005 - 2014). I would like to predict yields for 2015 based on this data.

Please note that the dataset has DAILY values for temperature and precipitation, but only 1 value per year for the yield, since harvesting of crop happens at end of growing season of crop.

I want to build a regression or some other machine learning based model to predict 2015 yields, based on a regression/some other model derived by studying the relation between yields and temperature and precipitation in previous years.

I am familiar with performing machine learning using scikit-learn. However, not sure how to represent this problem. The tricky part here is that temperature and precipitation are daily but yield is just 1 value per year.

How do I approach this?

  • $\begingroup$ even i'm trying to build a model to predict crop yield. Could you please share the details about the approach you are following? $\endgroup$
    – Nitz
    Feb 8, 2017 at 11:34
  • $\begingroup$ Were you able to get a complete answer. If no, please let me know and I will be happy to write a detailed answer on how to go about it given I work in the same domain $\endgroup$
    – 89_Simple
    Jun 8, 2018 at 14:07
  • $\begingroup$ @Crop89, that would be great! looking forward to your answer $\endgroup$
    – user308827
    Jun 8, 2018 at 23:22
  • $\begingroup$ Have you figured it out? I'm facing the same problem. Could you share the details if you have worked it out? much thanks $\endgroup$
    – eric huang
    Oct 12, 2018 at 2:00

3 Answers 3


For starters, you can predict the yield for the upcoming year based on the daily data for the previous year. You can estimate the model parameters by considering each year's worth of data as one "point", then validate the model using cross-validation. You can extend this model by considering more than the past year, but look back too far and you'll have trouble validating your model and overfit.

  • $\begingroup$ thanks @Emre, my confusion is that how do I treat an entire year's worth of data as 1 point? Doesn't each row of data (representing one day) constitute a sample in scikit-learn nomenclature? How do I treat an entire year as one sample rather than 365? $\endgroup$
    – user308827
    Jan 4, 2016 at 0:26
  • 1
    $\begingroup$ I was not addressing the specifics of sklearn, but since you asked, you want to be using the sklearn.cross_validation methods with "Label" in the name, such as sklearn.cross_validation.LabelKFold. $\endgroup$
    – Emre
    Jan 4, 2016 at 0:33
  • $\begingroup$ thanks @Emre, so the idea is to assign each year a single label, right? $\endgroup$
    – user308827
    Jan 4, 2016 at 1:05
  • $\begingroup$ Yes, @user308827. $\endgroup$
    – Emre
    Jan 4, 2016 at 1:51
  • $\begingroup$ thanks again @Emre, please have a look at the follow-up question: datascience.stackexchange.com/questions/9612/… $\endgroup$
    – user308827
    Jan 4, 2016 at 15:18

You have 10 data points with each data point having 365 (temperature for each day) + 365 (precipitation for each day) dimensions. Ideally, I would first reduce dimensions via machine learning methods, e.g. PCA. Then use machine learning methods to build a prediction model. However, due to the small dataset, I don't think machine learning techniques are appropriate to your problem.


You can use a Bayesian Belief Network for prediction. Here is a link for basic explanation: Bayesian Network


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.