哪些神经网络架构可以解决我的分类问题?
我是深度学习的新手,所以我需要一些建议。根据X,Y坐标和年,我的变量发生了变化。例如,根据“ x,y坐标”和变量“ b”根据“年”而变化的变量“ a”变化,并且根据两个变化,可变“ c”都会根据两个变化(x,y坐标和年)。我想创建一个时空预测模型。但是,变量“ c”不仅会影响目标变量“ t”,而且还会根据前2年的价值影响目标变量。在这种情况下,如何创建时空预测模型?哪些神经网络体系结构解决了我的分类问题?
import pandas as pd
data = {'x': [40.1, 50.1, 60.1, 70.1, 80.1, 90.1, 0, 300.1, 40.1, 50.1, 60.1, 70.1, 80.1, 90.1, 0, 300.1, 40.1, 50.1, 60.1, 70.1, 80.1, 90.1, 0, 300.1, 40.1, 50.1, 60.1, 70.1, 80.1, 90.1, 0, 300.1, 40.1, 50.1, 60.1, 70.1, 80.1, 90.1, 0, 300.1 ], 'y': [100.1, 110.1, 120.1, 130.1, 140.1, 150.1, 160.1, 400.1, 100.1, 110.1, 120.1, 130.1, 140.1, 150.1, 160.1, 400.1, 100.1, 110.1, 120.1, 130.1, 140.1, 150.1, 160.1, 400.1, 100.1, 110.1, 120.1, 130.1, 140.1, 150.1, 160.1, 400.1, 100.1, 110.1, 120.1, 130.1, 140.1, 150.1, 160.1, 400.1], 'a': [1.0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0 ], 'b': [1, 1, 1, 1, 1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2 ], 'c': [1.0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0], 't': [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 ], 'year': [2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004]}
df = pd.DataFrame(data)
df
x y a b c t year
0 40.1 100.1 1.0 1.0 1.0 1 2000
1 50.1 110.1 0.0 1.0 1.0 1 2000
2 60.1 120.1 1.0 1.0 1.0 1 2000
3 70.1 130.1 1.0 1.0 0.0 0 2000
4 80.1 140.1 0.0 1.0 0.0 0 2000
5 90.1 150.1 0.0 1.0 0.0 0 2000
6 0.0 160.1 0.0 1.0 0.0 0 2000
7 300.1 400.1 0.0 1.0 0.0 0 2000
8 40.1 100.1 1.0 0.5 1.0 0 2001
9 50.1 110.1 0.0 0.5 0.0 1 2001
10 60.1 120.1 1.0 0.5 1.0 0 2001
11 70.1 130.1 1.0 0.5 0.0 0 2001
12 80.1 140.1 0.0 0.5 0.0 1 2001
13 90.1 150.1 0.0 0.5 0.0 1 2001
14 0.0 160.1 0.0 0.5 1.0 0 2001
15 300.1 400.1 0.0 0.5 0.0 0 2001
16 40.1 100.1 1.0 0.9 1.0 0 2002
17 50.1 110.1 0.0 0.9 0.0 1 2002
18 60.1 120.1 1.0 0.9 0.0 1 2002
19 70.1 130.1 1.0 0.9 0.0 1 2002
20 80.1 140.1 0.0 0.9 1.0 0 2002
21 90.1 150.1 0.0 0.9 1.0 0 2002
22 0.0 160.1 0.0 0.9 0.0 1 2002
23 300.1 400.1 0.0 0.9 0.0 0 2002
24 40.1 100.1 1.0 0.3 1.0 0 2003
25 50.1 110.1 0.0 0.3 0.0 1 2003
26 60.1 120.1 1.0 0.3 0.0 1 2003
27 70.1 130.1 1.0 0.3 0.0 1 2003
28 80.1 140.1 0.0 0.3 0.0 0 2003
29 90.1 150.1 0.0 0.3 0.0 1 2003
30 0.0 160.1 0.0 0.3 1.0 0 2003
31 300.1 400.1 0.0 0.3 1.0 0 2003
32 40.1 100.1 1.0 0.2 1.0 0 2004
33 50.1 110.1 0.0 0.2 0.0 0 2004
34 60.1 120.1 1.0 0.2 0.0 0 2004
35 70.1 130.1 1.0 0.2 0.0 1 2004
36 80.1 140.1 0.0 0.2 1.0 1 2004
37 90.1 150.1 0.0 0.2 0.0 0 2004
38 0.0 160.1 0.0 0.2 0.0 0 2004
39 300.1 400.1 0.0 0.2 0.0 0 2004
I am new to deep learning so I need some advice. I have variables changing according to x, y coordinates, and year. For example, variable "a" changes according to "x, y coordinates" and variable "b" changes according to "year", and also, variable "c" changes according to both of them (x, y coordinates and year). I want to create a spatiotemporal prediction model. However, variable "c" affects the target variable "t" not only for that year but also according to its value in the previous 2 years. In that case, how can I create a spatiotemporal prediction model? Which neural network architectures solve my classification problem?
import pandas as pd
data = {'x': [40.1, 50.1, 60.1, 70.1, 80.1, 90.1, 0, 300.1, 40.1, 50.1, 60.1, 70.1, 80.1, 90.1, 0, 300.1, 40.1, 50.1, 60.1, 70.1, 80.1, 90.1, 0, 300.1, 40.1, 50.1, 60.1, 70.1, 80.1, 90.1, 0, 300.1, 40.1, 50.1, 60.1, 70.1, 80.1, 90.1, 0, 300.1 ], 'y': [100.1, 110.1, 120.1, 130.1, 140.1, 150.1, 160.1, 400.1, 100.1, 110.1, 120.1, 130.1, 140.1, 150.1, 160.1, 400.1, 100.1, 110.1, 120.1, 130.1, 140.1, 150.1, 160.1, 400.1, 100.1, 110.1, 120.1, 130.1, 140.1, 150.1, 160.1, 400.1, 100.1, 110.1, 120.1, 130.1, 140.1, 150.1, 160.1, 400.1], 'a': [1.0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0 ], 'b': [1, 1, 1, 1, 1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2 ], 'c': [1.0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0], 't': [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 ], 'year': [2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004]}
df = pd.DataFrame(data)
df
x y a b c t year
0 40.1 100.1 1.0 1.0 1.0 1 2000
1 50.1 110.1 0.0 1.0 1.0 1 2000
2 60.1 120.1 1.0 1.0 1.0 1 2000
3 70.1 130.1 1.0 1.0 0.0 0 2000
4 80.1 140.1 0.0 1.0 0.0 0 2000
5 90.1 150.1 0.0 1.0 0.0 0 2000
6 0.0 160.1 0.0 1.0 0.0 0 2000
7 300.1 400.1 0.0 1.0 0.0 0 2000
8 40.1 100.1 1.0 0.5 1.0 0 2001
9 50.1 110.1 0.0 0.5 0.0 1 2001
10 60.1 120.1 1.0 0.5 1.0 0 2001
11 70.1 130.1 1.0 0.5 0.0 0 2001
12 80.1 140.1 0.0 0.5 0.0 1 2001
13 90.1 150.1 0.0 0.5 0.0 1 2001
14 0.0 160.1 0.0 0.5 1.0 0 2001
15 300.1 400.1 0.0 0.5 0.0 0 2001
16 40.1 100.1 1.0 0.9 1.0 0 2002
17 50.1 110.1 0.0 0.9 0.0 1 2002
18 60.1 120.1 1.0 0.9 0.0 1 2002
19 70.1 130.1 1.0 0.9 0.0 1 2002
20 80.1 140.1 0.0 0.9 1.0 0 2002
21 90.1 150.1 0.0 0.9 1.0 0 2002
22 0.0 160.1 0.0 0.9 0.0 1 2002
23 300.1 400.1 0.0 0.9 0.0 0 2002
24 40.1 100.1 1.0 0.3 1.0 0 2003
25 50.1 110.1 0.0 0.3 0.0 1 2003
26 60.1 120.1 1.0 0.3 0.0 1 2003
27 70.1 130.1 1.0 0.3 0.0 1 2003
28 80.1 140.1 0.0 0.3 0.0 0 2003
29 90.1 150.1 0.0 0.3 0.0 1 2003
30 0.0 160.1 0.0 0.3 1.0 0 2003
31 300.1 400.1 0.0 0.3 1.0 0 2003
32 40.1 100.1 1.0 0.2 1.0 0 2004
33 50.1 110.1 0.0 0.2 0.0 0 2004
34 60.1 120.1 1.0 0.2 0.0 0 2004
35 70.1 130.1 1.0 0.2 0.0 1 2004
36 80.1 140.1 0.0 0.2 1.0 1 2004
37 90.1 150.1 0.0 0.2 0.0 0 2004
38 0.0 160.1 0.0 0.2 0.0 0 2004
39 300.1 400.1 0.0 0.2 0.0 0 2004
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有时,问题不在于你使用什么模型,而在于你如何改变你的功能。您说您的目标取决于过去的特征值,因此您可以重新排列数据以反映这一点。
这是如何将三个连续的行连接成一行的方法。
您现在可以拟合任何分类模型。我选择了 sklearn 中的一个简单的逻辑回归器。
相同模型在纯数据上的得分
0.625
,添加额外的时间步得分0.8108
。我并不是说这是唯一的方法,但确实值得考虑。
有关更多详细信息,您可以阅读 https://machinelearningmastery.com/basic -feature-engineering-time-series-data-python/。
Sometimes it's not a matter of what model you use, but how you transform your features. You say that your target depends on past feature values, so you can rearrange your data to reflect this.
Here it is how to concatenate three consecutive rows into a single one.
You can now fit any classification model. I have chosen a simple logistic regressor from sklearn.
The same model on the plain data scores
0.625
, adding an extra timestep scores0.8108
.I'm not saying this is the only approach but certainly something to consider.
For more details you can read https://machinelearningmastery.com/basic-feature-engineering-time-series-data-python/.