當前位置: 首頁>>代碼示例>>Python>>正文


Python Classifier.cleanClassificationTables方法代碼示例

本文整理匯總了Python中Classifier.Classifier.cleanClassificationTables方法的典型用法代碼示例。如果您正苦於以下問題:Python Classifier.cleanClassificationTables方法的具體用法?Python Classifier.cleanClassificationTables怎麽用?Python Classifier.cleanClassificationTables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Classifier.Classifier的用法示例。


在下文中一共展示了Classifier.cleanClassificationTables方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: from Classifier import Classifier [as 別名]
# 或者: from Classifier.Classifier import cleanClassificationTables [as 別名]
def run():
    connection = PgSQL.connect(user = "postgres", database = DatabaseName);
    memDb = redis.Redis( host='localhost', port=6379 );
    TrainDbConfig = DbBuildConfig['train'];
    TestDbConfig = DbBuildConfig['test'];
    trainDocDb = DocumentsDatabase(connection, 
                                   TrainDbConfig['DocTagsTable'], 
                                   TrainDbConfig['RawDocTable'], 
                                   TrainDbConfig['TagsTable'], 
                                   TrainDbConfig['DocumentsTable'] );
    trainFeatureDb = FeatureDatabase(connection, 
                                     memDb, 
                                     trainDocDb, 
                                     TrainDbConfig['FeaturesTable'], 
                                     TrainDbConfig['DocFeaturesTable'],
                                     TrainDbConfig['TagSpecificFeatureTable']);
    testFeatureDb = FeatureDatabase(connection, 
                                    memDb, 
                                    None, 
                                    TestDbConfig['FeaturesTable'], 
                                    TestDbConfig['DocFeaturesTable'],
                                    TestDbConfig['TagSpecificFeatureTable']);

    classifier = Classifier(connection, trainFeatureDb, testFeatureDb, 
                   ClassifierTableConfig['predictedTrain'],
                   ClassifierTableConfig['predictedTest'], trainDocDb);

#    classifier.createTables();
    classifier.createTagPredictTables();
    classifier.cleanClassificationTables();
    tags = trainDocDb.getTagsList();
    s1 = 0;
    s2 = 0;
    for tag in tags:
        features = trainFeatureDb.getTagSpecificFeatures( tag );
        testTag = tag;
        hashes = trainFeatureDb.getTagSpecificFeatures(testTag);
        if not hashes:
            continue;
        c1 = trainDocDb.getTagCount(testTag);
        if c1 <= 25:
            continue;
        s1 += c1;
        print classifier.predictForTag( tag );
    classifier.saveClassificationResults();
開發者ID:eshavlyugin,項目名稱:Facebook-Hacker-Cup-III,代碼行數:47,代碼來源:ClassifierTest.py


注:本文中的Classifier.Classifier.cleanClassificationTables方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。