I have these two datasets, one of these is various index for long long period and the second one is the total number of typhoons for same period as the former one.
First dataset (dimension : (22, 30) )
A B C D E F G H I J \
Unnamed: 0
1979 1803.0 1.1 0.16 -0.15 -0.29 -0.24 -0.08 0.42 0.10 -0.81
1980 1932.0 -0.0 -0.36 0.08 0.21 0.16 0.64 0.47 -0.08 1.21
1981 1569.0 2.0 -0.63 -0.43 -0.46 -0.59 -0.47 0.18 -0.22 -0.80
1982 1719.0 -1.7 0.13 0.54 0.53 0.45 1.74 -0.15 -0.45 -0.14
1983 1386.0 0.1 4.24 1.52 0.54 -0.00 0.82 0.35 -0.45 4.82
1984 1003.0 -0.6 -0.95 -1.17 -0.90 -0.78 -0.28 -0.37 0.46 -2.62
1985 761.0 -0.6 -1.27 -1.02 -0.91 -0.95 -0.11 -0.30 0.04 -1.59
Second dataset (dimension : (30, ))
Unnamed: 0
1979 0.68
1980 0.45
1981 0.20
1982 1.14
1983 1.38
1984 -1.89
1985 0.25
1986 -0.17
1987 0.58
I want to make ANN model which can predict the total number (like first dataset) for future while using various index (like second dataset), so I tried to make a model for it.
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
# upload dataset
X = pd.read_csv('index.csv')
X.set_index('Unnamed: 0', inplace=True)
X = X.T
X = X.values
raw_data = pd.read_csv('sum.csv')
y = raw_data.iloc[30:60, -1]
y = y.values
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
But I got an error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-50-5f25f916c229> in <module>
16 y = y.values
17
---> 18 X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
2 frames
/usr/local/lib/python3.7/dist-packages/sklearn/utils/validation.py in check_consistent_length(*arrays)
332 raise ValueError(
333 "Found input variables with inconsistent numbers of samples: %r"
--> 334 % [int(l) for l in lengths]
335 )
336
ValueError: Found input variables with inconsistent numbers of samples: [22, 30]
How can I deal with this new ANN problem and more essential problem (dimension stuff)?