本文整理汇总了Python中tpot.TPOT._linear_svc方法的典型用法代码示例。如果您正苦于以下问题:Python TPOT._linear_svc方法的具体用法?Python TPOT._linear_svc怎么用?Python TPOT._linear_svc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tpot.TPOT
的用法示例。
在下文中一共展示了TPOT._linear_svc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_linear_svc_2
# 需要导入模块: from tpot import TPOT [as 别名]
# 或者: from tpot.TPOT import _linear_svc [as 别名]
def test_linear_svc_2():
"""Ensure that the TPOT LinearSVC outputs the same as the sklearn LinearSVC when C == 0.0"""
tpot_obj = TPOT()
result = tpot_obj._linear_svc(training_testing_data, 0.0, 0, True)
result = result[result['group'] == 'testing']
lsvc = LinearSVC(C=0.0001, penalty='l1', dual=False, random_state=42)
lsvc.fit(training_features, training_classes)
assert np.array_equal(result['guess'].values, lsvc.predict(testing_features))
示例2: test_linear_svc
# 需要导入模块: from tpot import TPOT [as 别名]
# 或者: from tpot.TPOT import _linear_svc [as 别名]
def test_linear_svc():
"""Ensure that the TPOT LinearSVC outputs the same as the sklearn LinearSVC"""
tpot_obj = TPOT()
result = tpot_obj._linear_svc(training_testing_data, 1.0, 0, 0)
result = result[result['group'] == 'testing']
lsvc = LinearSVC(C=1.0, loss='hinge', fit_intercept=True, random_state=42)
lsvc.fit(training_features, training_classes)
assert np.array_equal(result['guess'].values, lsvc.predict(testing_features))