Skip to Main Content
Python 机器学习实践:测试驱动的开发方法
book

Python 机器学习实践:测试驱动的开发方法

by Matthew Kirk
January 2018
Intermediate to advanced content levelIntermediate to advanced
211 pages
8h 31m
Chinese
China Machine Press
Content preview from Python 机器学习实践:测试驱动的开发方法
支持向量机
125
return SentimentClassifier(corpus_set)
def __init__(self, corpus_set):
self._trained = False
self._corpus_set = corpus_set
self._c = 2 ** 7
self._model = None
@property
def c(self):
return self._c
@c.setter
def c(self, cc):
self._c = cc
def reset_model(self):
self._model = None
def words(self):
return self._corpus_set.words
def classify(self, string):
if self._model is None:
self._model = self.fit_model()
prediction = self._model.predict(self._corpus_set.feature_vector(string))
return self.present_answer(prediction)
def fit_model(self):
self._corpus_set.calculate_sparse_vectors()
y_vec = self._corpus_set.yes
x_mat = self._corpus_set.xes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Python for Bioinformatics

Mastering Python for Bioinformatics

Ken Youens-Clark

Publisher Resources

ISBN: 9787111581666