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


Python Parameterization.get_NowellAuthorsCore方法代碼示例

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


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

示例1: execution

# 需要導入模塊: from parametering.Parameterization import Parameterization [as 別名]
# 或者: from parametering.Parameterization.Parameterization import get_NowellAuthorsCore [as 別名]
def execution(configFile):
    #DEFINE THE FILE THAT WILL KEEP THE RESULT DATA
    resultFile = open(FormatingDataSets.get_abs_file_path(configFile + '.firstTabletsALLCORE02DECAY02.txt'), 'w')
    #READING THE CONFIG FILE
    util = ParameterUtil(parameter_file = configFile)
    #CREATING PARAMETRIZATION OBJECT WITH THE INFORMATIONS OF THE CONFIG FILE.
    myparams = Parameterization(t0 = util.t0, t0_ = util.t0_, t1 = util.t1, t1_ = util.t1_, linear_combination=util.linear_combination,
                                filePathGraph = util.graph_file, filePathTrainingGraph = util.trainnig_graph_file, filePathTestGraph = util.test_graph_file, decay = util.decay, domain_decay = util.domain_decay, min_edges = util.min_edges, scoreChoiced = util.ScoresChoiced, weightsChoiced = util.WeightsChoiced, weightedScoresChoiced = util.WeightedScoresChoiced, FullGraph = None, result_random_file=util.result_random_file)
    #GENERATING TRAINNING GRAPH BASED ON CONFIG FILE T0 AND T0_
    myparams.generating_Training_Graph()
    #GENERATING TEST GRAPH BASED ON CONFIG FILE T1 AND T1_
    myparams.generating_Test_Graph()
    #GET THE AUTHORS THAT PUBLISH AT TRAINNING AND TEST 
    #A NUMBER OF PAPERS DEFINED AT MIN_EDGES IN CONFIG FILE
    nodes = myparams.get_NowellAuthorsCore()
    #GET A PAIR OF AUTHORS THAT PUBLISH AT LEAST ONE ARTICLE AT TRAINNING AND TEST.
    #DID NOT SEE ANY NEED
    collaborations = myparams.get_NowellColaboration()
    #GET THE FIRST EDGES MADE BY THE COMBINATION OF NODES IN TRAINNING GRAPH
    eOld = myparams.get_NowellE(nodes,myparams.trainnigGraph)
    #GET THE FIRST EDGES MADE BY THE COMBINATION OF NODES IN TEST GRAPH THAT DO NOT HAVE EDGES IN TRAINNING
    eNew = myparams.get_NowellE2(nodes, eOld, myparams.testGraph)
    #GET THE NODES NOT LINKED OVER THE COMBINATION NODES.
    nodesNotLinked = myparams.get_PairsofNodesNotinEold(nodes)
    #CREATING CALCULATION OBJECT
    calc = CalculateInMemory(myparams,nodesNotLinked)
    #CALCULATING THE SCORES.
    resultsofCalculation = calc.executingCalculate()
    #ORDERNING THE RESULTS RETURNING THE TOP N 
    orderingResults = calc.ordering(len(eNew), resultsofCalculation)
    #SAVING THE ORDERED RESULTS.
    calc.saving_orderedResult(util.ordered_file, orderingResults)
    #ANALISE THE ORDERED RESULTS AND CHECK THE FUTURE.
    ScoresResults = Analyse.AnalyseNodesWithScoresInFuture(orderingResults, myparams.testGraph)
    #SAVING THE RESULTS.  
    for index in range(len(ScoresResults)):
        Analyse.saving_analyseResult(ScoresResults[index], util.analysed_file + str(myparams.ScoresChoiced[index][0] ) + '.txt')
        resultFile.write("TOTAL OF SUCESSS USING METRIC "  + str(myparams.ScoresChoiced[index][0])  + " = " +  str(Analyse.get_TotalSucess(ScoresResults[index]) ))
        resultFile.write("\n")
        resultFile.write("\n")
        
    resultFile.write("Authors\tArticles\tCollaborations\tAuthors\tEold\tEnew\n")
    resultFile.write( str(myparams.get_nodes(myparams.trainnigGraph))+ "\t" + str(myparams.get_edges(myparams.trainnigGraph)) + "\t\t" + str(len(collaborations)*2)+ "\t\t" + str(len(nodes)) + "\t" + str(len(eOld))+"\t" + str(len(eNew)))
    
    resultFile.write("\n")
    resultFile.close()
開發者ID:AndersonChaves,項目名稱:Predicao-de-Links,代碼行數:48,代碼來源:ExecutionNowellFirstTable.py


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