Borrar filtros
Borrar filtros

error with Input data sizes in using sim

1 visualización (últimos 30 días)
arash rad
arash rad el 10 de Oct. de 2022
Comentada: arash rad el 11 de Oct. de 2022
Hi i write this code
but i have a problem when i use sim it has an error that "Input data sizes do not match net.inputs{1}.size."
I am new to ANN and i don't know what should i do
clc;clear all ; close all
%% Import Data
filename = 'zafar_queue.csv'; % abc = name of data file
flow_data = csv2struct(filename);
%% Variables
Y = flow_data.nVehContrib;
data = Y';
periods = flow_data.begin;
dates = seconds(periods);
trn = floor(0.95*(length(data)));
data_train = data(1:trn);
data_test = data(trn+1:end);
trnX = data_train(1:end);
trnY = data_train(1:end);
trndates = dates(1:trn);
testX = data_test(1:end);
testY = data_test(1:end);
testdates = dates(trn+1:end);
%% Neural (Model)
net = newfit(trnX',trnY',30);
[net,tr] = train(net, trnX', trnY');
%% Forecast and error
load_forecast = sim(net,testX)';
% err = testY - load_forecast;
% errp = (abs(err)./testY)*100;
%
% mae = mean(testY, load_forecast);
% mape = mean(errp);
%% Figures
h2 = figure;
plot(testY,'DisplayName','testY');hold on;plot(load_forecast,'DisplayName','forecast');hold off;
ylabel('Load');
h3 = figure;
plot(testdates, testY - load_forecast);
xlabel('Date'); ylabel('Error');
  2 comentarios
Benjamin Thompson
Benjamin Thompson el 10 de Oct. de 2022
Can you attach your CSV file so the Community can run your example code?
arash rad
arash rad el 11 de Oct. de 2022
Hi Benjamin
I attached my data

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by