def evaluate_embeddings(embeddings): X, Y = read_node_label('../data/flight/labels-brazil-airports.txt', skip_head=True) tr_frac = 0.8 print("Training classifier using {:.2f}% nodes...".format(tr_frac * 100)) clf = Classifier(embeddings=embeddings, clf=LogisticRegression()) clf.split_train_evaluate(X, Y, tr_frac)
def evaluate_embeddings(embeddings): X, Y = read_node_label('../data/wiki/wiki_labels.txt') tr_frac = 0.8 print("Training classifier using {:.2f}% nodes...".format( tr_frac * 100)) clf = Classifier(embeddings=embeddings, clf=LogisticRegression()) clf.split_train_evaluate(X, Y, tr_frac)
def evaluate_embeddings(embeddings): #读入真实的分类label X, Y = read_node_label('../data/wiki/wiki_labels.txt') tr_frac = 0.8 #80%的节点用于训练分类器,其余的用于测试 print("Training classifier using {:.2f}% nodes...".format(tr_frac * 100)) #应用分类器对节点进行分类以评估向量的质量 clf = Classifier(embeddings=embeddings, clf=LogisticRegression()) clf.split_train_evaluate(X, Y, tr_frac)
def evaluate_embeddings(embeddings, X, Y, X_train, y_train, X_test, y_test, log_key): clf = Classifier(embeddings=embeddings, clf=LogisticRegression(solver='liblinear')) clf.split_train_evaluate(X, Y, X_train, y_train, X_test, y_test, log_key=log_key)
def evaluate_embeddings(embeddings): X, Y = read_node_label( '../data/ETH/Phishing node classification/label.txt', skip_head=True) tr_frac = 0.8 print("Training classifier using {:.2f}% nodes...".format(tr_frac * 100)) clf = Classifier(embeddings=embeddings, clf=LogisticRegression()) clf.split_train_evaluate(X, Y, tr_frac)
def evaluate_embeddings(embeddings): """ 一个分类器函数,用来评价向量好坏,因为每个实体有对应的标签,通过向量实现多分类 :param embeddings: :return: """ X, Y = read_node_label( '/Users/admin/Desktop/GraphEmbedding-deeplearning/data/XunYiWenYao/寻医问药category.txt' ) tr_frac = 0.8 print("Training classifier using {:.2f}% nodes...".format(tr_frac * 100)) clf = Classifier(embeddings=embeddings, clf=LogisticRegression()) clf.split_train_evaluate(X, Y, tr_frac)
def evaluate_embeddings(embeddings): """分割训练评估,输出性能参数 :param embeddings: """ # X, Y = read_node_label('../data/wiki/wiki_labels.txt') # X, Y = read_node_label('../data/flight/labels-brazil-airports.txt', True) # X, Y = read_node_label('../data/flight/labels-europe-airports.txt', True) X, Y = read_node_label('../data/flight/labels-usa-airports.txt', True) tr_frac = 0.8 # 交叉验证百分比 print("Training classifier using {:.2%} nodes...".format(tr_frac)) clf = Classifier(embeddings=embeddings, clf=LogisticRegression()) return clf.split_train_evaluate(X, Y, tr_frac)