genetic algorithm
Show older comments
Dear all,
Please please someone help me urgently.
I want to use genetic algorithm on a weather dataset that has values for actual_observed weather variable and forecasts made by 4 different ways for that weather variable. Though the dataset contains thousands of rows but as a sample please provide me help for 10 rows of data.
This is stored in a matrix of 10rows X 5columns. Rows corresponds to temperature at 10 places forecasted by 4 different forecasting methods and last column is for the observed actual temperature at those 10 places.
Using ga, I need to know which one of these 4 forecasts are closest to the actual observed forecast. For this purpose, I am calculating error as(actual_observed - forecast)/ actual_observed. So, the result of this error, I am storing in another matrix of 10rows X 4 columns. The fitness function should search the column that has minimum error value. Please advise urgently, how to apply GA on such data.
Alternatively, I have tried calculate error and store in excel. Now I have written following fitness function. But I am getting error
??? In an assignment A(:) = B, the number of elements in A and B
must be the same.
Error in ==> ga at 188
state.Score(thisPopulation) = score;
function y = singlefitfun(xvector)
x1error=xvector(1:10);
x2error=xvector(11:20);
x3error=xvector(21:30);
x4error=xvector(31:40);
y=zeros(80,1);
for i = 1:10
y(i) = (x1error(i) + x2error(i) + x3error(i) + x4error(i))/4;
end
Accepted Answer
More Answers (0)
Categories
Find more on Weather and Atmospheric Science in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!