赞
踩
dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)
drop table table5
create table table5
(dim0 int not null,
dim1 int not null,
dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)
drop table table6
create table table6
(dim0 int not null,
dim1 int not null,
dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)
drop table table7
create table table7
(dim0 int not null,
dim1 int not null,
dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)
drop table table8
create table table8
(dim0 int not null,
dim1 int not null,
dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)
drop table table9
create table table9
(dim0 int not null,
dim1 int not null,
dim2 int not null,
dim3 int not null,
dim4 int not null,
dim5 int not null,
dim6 int not null,
dim7 int not null,
dim8 int not null)
LearningDB.py程序如下:
‘’’
LearningDB类
功能:定义数据库类,包含一个学习函数learn_data和一个识别函数identify_data
作者:PyLearn
博客: http://www.cnblogs.com/PyLearn/
最后修改日期: 2017/10/18
‘’’
import math
import pymssql
class LearningDB():
def \_\_init\_\_(self):
self.conn = pymssql.connect(host='127.0.0.1',
user='sa',
password='123',
database='PyLearningDB',
charset='utf8')
self.cursor = self.conn.cursor()
self.sql = ''
self.distance = 0.0
self.conn.close()
def learn\_data(self, table, dim):
'''
学习数据,将数据存到对应的数据库
table指定哪个表,dim是维度数组
‘’’
learn_result = False
try:
if table < 0 or table > 9:
raise Exception("错误!table的值为%d!" % table)
for num in dim:
if num < 0:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。