【发布时间】:2016-07-06 09:58:53
【问题描述】:
这样的数据:
x y
7773 0
9805 4
7145 0
7645 1
2529 1
4814 2
6027 2
7499 2
3367 1
8861 5
9776 2
8009 5
3844 2
1218 2
1120 1
4553 0
3017 1
2582 2
1691 2
5342 0
...
真正的函数f(x)是:(返回一个十进制整数的圈数)
# 0 1 2 3 4 5 6 7 8 9
_f_map = [1, 0, 0, 0, 0, 0, 1, 0, 2, 1]
def f(x):
x = int(x)
assert x >= 0
if x == 0:
return 1
r = 0
while x:
r += _f_map[x % 10]
x /= 10
return r
训练数据和测试数据可以随机产生:
data = []
target = []
for i in xrange(3000):
x = random.randint(0, 999999) #hardcode a scale
data.append([x])
target.append(f(x))
真正的函数是离散的无限尺度的。
有没有办法或模型可以对这些数据进行分类?
我尝试了 SVM(支持向量机),并获得了 20% 的准确率。
【问题讨论】:
标签: machine-learning classification discrete-mathematics supervised-learning