本文整理汇总了Python中utilities.Utilities.getClassifierLengthsByDay方法的典型用法代码示例。如果您正苦于以下问题:Python Utilities.getClassifierLengthsByDay方法的具体用法?Python Utilities.getClassifierLengthsByDay怎么用?Python Utilities.getClassifierLengthsByDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utilities.Utilities
的用法示例。
在下文中一共展示了Utilities.getClassifierLengthsByDay方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fixedWindowByRelabelingDocuments
# 需要导入模块: from utilities import Utilities [as 别名]
# 或者: from utilities.Utilities import getClassifierLengthsByDay [as 别名]
def fixedWindowByRelabelingDocuments():
global maxLength, idealModelLength
currentDay = Settings.startTime
while currentDay<=Settings.endTime:
noOfDaysList = list(set([idealModelLength]).intersection(set(Utilities.getClassifierLengthsByDay(currentDay, maxLength))))
print currentDay, noOfDaysList
for noOfDays in noOfDaysList: FixedWindowWithRelabeledDocumentsClassifier(currentTime=currentDay, numberOfExperts=Settings.numberOfExperts, dataType=DocumentType.typeRuuslUnigram, noOfDays=noOfDays).trainAndSave()
currentDay+=timedelta(days=1)
示例2: fixedWindowOfDifferentLengthsAndDataTypes
# 需要导入模块: from utilities import Utilities [as 别名]
# 或者: from utilities.Utilities import getClassifierLengthsByDay [as 别名]
def fixedWindowOfDifferentLengthsAndDataTypes():
global maxLength, idealModelLength
dataTypes = [DocumentType.typeRuuslUnigramNounsWithMeta]
currentDay = Settings.startTime
while currentDay<=Settings.endTime:
noOfDaysList = list(set([idealModelLength]).intersection(set(Utilities.getClassifierLengthsByDay(currentDay, maxLength))))
print currentDay, noOfDaysList
for noOfDays in noOfDaysList:
for dataType in dataTypes: FixedWindowClassifier(currentTime=currentDay, numberOfExperts=Settings.numberOfExperts, dataType=dataType, noOfDays=noOfDays).trainAndSave()
currentDay+=timedelta(days=1)
示例3: generate
# 需要导入模块: from utilities import Utilities [as 别名]
# 或者: from utilities.Utilities import getClassifierLengthsByDay [as 别名]
def generate(numberOfExperts=Settings.numberOfExperts):
global maxLength, idealModelLength
currentDay = Settings.startTime
collocationMeasures = [Collocations.measureTypeRawFrequency, Collocations.measureTypeChiSquare, Collocations.measureTypeLikelihoodRatio, Collocations.measureTypePMI, Collocations.measureTypeStudentT]
while currentDay<=Settings.endTime:
noOfDaysList = list(set([idealModelLength]).intersection(set(Utilities.getClassifierLengthsByDay(currentDay, maxLength))))
for noOfDays in noOfDaysList:
for collocationMeasure in collocationMeasures:
print currentDay, collocationMeasure, noOfDays
Collocations(collocationMeasure, currentTime=currentDay, numberOfExperts=numberOfExperts, dataType=DocumentType.typeRuuslUnigram, noOfDays=noOfDays).discoverAndWrite()
currentDay+=timedelta(days=1)
示例4: generateStatsToDetermineFixedWindowLength
# 需要导入模块: from utilities import Utilities [as 别名]
# 或者: from utilities.Utilities import getClassifierLengthsByDay [as 别名]
def generateStatsToDetermineFixedWindowLength():
global maxLength
currentDay = Settings.startTime
while currentDay<=Settings.endTime:
for noOfDays in Utilities.getClassifierLengthsByDay(currentDay, maxLength):
classifier = FixedWindowClassifier(currentTime=currentDay, numberOfExperts=Settings.numberOfExperts, dataType=DocumentType.typeRuuslUnigram, noOfDays=noOfDays)
classifier.load()
data = {'day': datetime.strftime(currentDay, Settings.twitter_api_time_format), 'classifier_length': noOfDays, 'metric': 'aucm', 'number_of_experts': Settings.numberOfExperts, 'data_type': DocumentType.typeRuuslUnigram, 'test_data_days': 1}
data['value'] = classifier.getAUCM(TestDocuments(currentTime=currentDay+timedelta(days=1), numberOfExperts=Settings.numberOfExperts, dataType=DocumentType.typeRuuslUnigram, noOfDays=1).iterator())
Utilities.writeAsJsonToFile(data, Settings.stats_to_determine_fixed_window_length)
currentDay+=timedelta(days=1)
示例5: fixedWindowWithCollocationsForDifferentCollocations
# 需要导入模块: from utilities import Utilities [as 别名]
# 或者: from utilities.Utilities import getClassifierLengthsByDay [as 别名]
def fixedWindowWithCollocationsForDifferentCollocations(numberOfExperts=Settings.numberOfExperts):
global maxLength, idealModelLength
dataType = DocumentType.typeRuuslUnigram
collocationMeasures = [Collocations.measureTypeLikelihoodRatio, Collocations.measureTypeChiSquare]
currentDay = Settings.startTime
while currentDay<=Settings.endTime:
noOfDaysList = list(set([idealModelLength]).intersection(set(Utilities.getClassifierLengthsByDay(currentDay, maxLength))))
print currentDay, noOfDaysList
for noOfDays in noOfDaysList:
for collocationMeasure in collocationMeasures: FixedWindowWithCollocationsClassifier(collocationMeasure=collocationMeasure, currentTime=currentDay, numberOfExperts=numberOfExperts, dataType=dataType, noOfDays=noOfDays).trainAndSave()
currentDay+=timedelta(days=1)
示例6: generateStatsObservePerformanceByRelabelingDocuments
# 需要导入模块: from utilities import Utilities [as 别名]
# 或者: from utilities.Utilities import getClassifierLengthsByDay [as 别名]
def generateStatsObservePerformanceByRelabelingDocuments():
global maxLength, idealModelLength
currentDay = Settings.startTime
while currentDay<=Settings.endTime:
noOfDaysList = list(set([idealModelLength]).intersection(set(Utilities.getClassifierLengthsByDay(currentDay, maxLength))))
for noOfDays in noOfDaysList:
classifier = FixedWindowWithRelabeledDocumentsClassifier(currentTime=currentDay, numberOfExperts=Settings.numberOfExperts, dataType=DocumentType.typeRuuslUnigram, noOfDays=noOfDays)
classifier.load()
data = {'day': datetime.strftime(currentDay, Settings.twitter_api_time_format), 'classifier_length': noOfDays, 'metric': 'aucm', 'number_of_experts': Settings.numberOfExperts, 'data_type': DocumentType.typeRuuslUnigram, 'test_data_days': 1}
data['value'] = classifier.getAUCM(TestDocuments(currentTime=currentDay+timedelta(days=1), numberOfExperts=Settings.numberOfExperts, dataType=DocumentType.typeRuuslUnigram, noOfDays=1).iterator())
Utilities.writeAsJsonToFile(data, Settings.stats_to_observe_performance_by_relabeling_documents)
currentDay+=timedelta(days=1)
示例7: generateStatsToCompareDifferentDocumentTypes
# 需要导入模块: from utilities import Utilities [as 别名]
# 或者: from utilities.Utilities import getClassifierLengthsByDay [as 别名]
def generateStatsToCompareDifferentDocumentTypes():
global maxLength, idealModelLength
dataTypes = [DocumentType.typeRuuslUnigram, DocumentType.typeCharBigram, DocumentType.typeCharTrigram, DocumentType.typeRuuslBigram, DocumentType.typeRuuslTrigram, DocumentType.typeRuuslSparseBigram,
DocumentType.typeRuuslUnigramNouns, DocumentType.typeRuuslUnigramWithMeta, DocumentType.typeRuuslUnigramNounsWithMeta]
currentDay = Settings.startTime
while currentDay<=Settings.endTime:
noOfDaysList = list(set([idealModelLength]).intersection(set(Utilities.getClassifierLengthsByDay(currentDay, maxLength))))
for noOfDays in noOfDaysList:
for dataType in dataTypes:
print currentDay, noOfDays, dataType
classifier = FixedWindowClassifier(currentTime=currentDay, numberOfExperts=Settings.numberOfExperts, dataType=dataType, noOfDays=noOfDays)
classifier.load()
data = {'day': datetime.strftime(currentDay, Settings.twitter_api_time_format), 'classifier_length': noOfDays, 'metric': 'aucm', 'number_of_experts': Settings.numberOfExperts, 'data_type': dataType, 'test_data_days': 1}
data['value'] = classifier.getAUCM(TestDocuments(currentTime=currentDay+timedelta(days=1), numberOfExperts=Settings.numberOfExperts, dataType=dataType, noOfDays=1).iterator())
Utilities.writeAsJsonToFile(data, Settings.stats_to_compare_different_document_types)
currentDay+=timedelta(days=1)
示例8: generateStatsToCompareCollocations
# 需要导入模块: from utilities import Utilities [as 别名]
# 或者: from utilities.Utilities import getClassifierLengthsByDay [as 别名]
def generateStatsToCompareCollocations():
global maxLength, idealModelLength
dataType = DocumentType.typeRuuslUnigram
collocationMeasures = [Collocations.measureTypeChiSquare, Collocations.measureTypeLikelihoodRatio]
currentDay = Settings.startTime
while currentDay<=Settings.endTime:
noOfDaysList = list(set([idealModelLength]).intersection(set(Utilities.getClassifierLengthsByDay(currentDay, maxLength))))
print currentDay, noOfDaysList
for noOfDays in noOfDaysList:
for collocationMeasure in collocationMeasures:
classifier = FixedWindowWithCollocationsClassifier(collocationMeasure=collocationMeasure, currentTime=currentDay, numberOfExperts=Settings.numberOfExpertsSecondSet, dataType=dataType, noOfDays=noOfDays)
classifier.load()
data = {'day': datetime.strftime(currentDay, Settings.twitter_api_time_format), 'classifier_length': noOfDays, 'metric': 'aucm', 'number_of_experts': Settings.numberOfExpertsSecondSet, 'data_type': dataType, 'collocation_measure': collocationMeasure, 'test_data_days': 1}
data['value'] = classifier.getAUCM(TestDocumentsWithCollocations(collocationMeasure, currentTime=currentDay+timedelta(days=1), numberOfExperts=Settings.numberOfExperts, dataType=dataType, noOfDays=1).iterator())
Utilities.writeAsJsonToFile(data, Settings.stats_to_compare_collocations)
currentDay+=timedelta(days=1)