当前位置: 首页>>代码示例>>Python>>正文


Python mnist_loader.load_data方法代码示例

本文整理汇总了Python中mnist_loader.load_data方法的典型用法代码示例。如果您正苦于以下问题:Python mnist_loader.load_data方法的具体用法?Python mnist_loader.load_data怎么用?Python mnist_loader.load_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mnist_loader的用法示例。


在下文中一共展示了mnist_loader.load_data方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_svms

# 需要导入模块: import mnist_loader [as 别名]
# 或者: from mnist_loader import load_data [as 别名]
def run_svms():
    svm_training_data, svm_validation_data, svm_test_data \
        = mnist_loader.load_data()
    accuracies = []
    for size in SIZES:
        print "\n\nTraining SVM with data set size %s" % size
        clf = svm.SVC()
        clf.fit(svm_training_data[0][:size], svm_training_data[1][:size])
        predictions = [int(a) for a in clf.predict(svm_validation_data[0])]
        accuracy = sum(int(a == y) for a, y in 
                       zip(predictions, svm_validation_data[1])) / 100.0
        print "Accuracy was %s percent" % accuracy
        accuracies.append(accuracy)
    f = open("more_data_svm.json", "w")
    json.dump(accuracies, f)
    f.close() 
开发者ID:skylook,项目名称:neural-networks-and-deep-learning,代码行数:18,代码来源:more_data.py

示例2: main

# 需要导入模块: import mnist_loader [as 别名]
# 或者: from mnist_loader import load_data [as 别名]
def main():
    training_data, validation_data, test_data = mnist_loader.load_data()
    # training phase: compute the average darknesses for each digit,
    # based on the training data
    avgs = avg_darknesses(training_data)
    # testing phase: see how many of the test images are classified
    # correctly
    num_correct = sum(int(guess_digit(image, avgs) == digit)
                      for image, digit in zip(test_data[0], test_data[1]))
    print("Baseline classifier using average darkness of image.")
    print("{0} of {1} values correct.".format(num_correct, len(test_data[1]))) 
开发者ID:Charleswyt,项目名称:machine-deep_learning,代码行数:13,代码来源:mnist_average_darkness.py

示例3: svm_baseline

# 需要导入模块: import mnist_loader [as 别名]
# 或者: from mnist_loader import load_data [as 别名]
def svm_baseline():
    training_data, validation_data, test_data = mnist_loader.load_data()
    # train
    clf = svm.SVC()
    clf.fit(training_data[0], training_data[1])
    # test
    predictions = [int(a) for a in clf.predict(test_data[0])]
    num_correct = sum(int(a == y) for a, y in zip(predictions, test_data[1]))
    print "Baseline classifier using an SVM."
    print "%s of %s values correct." % (num_correct, len(test_data[1])) 
开发者ID:Charleswyt,项目名称:machine-deep_learning,代码行数:12,代码来源:mnist_svm.py

示例4: main

# 需要导入模块: import mnist_loader [as 别名]
# 或者: from mnist_loader import load_data [as 别名]
def main():
    training_set, validation_set, test_set = mnist_loader.load_data()
    images = get_images(training_set)
    plot_rotated_image(images[0])

#### Plotting 
开发者ID:skylook,项目名称:neural-networks-and-deep-learning,代码行数:8,代码来源:mnist.py

示例5: load_data

# 需要导入模块: import mnist_loader [as 别名]
# 或者: from mnist_loader import load_data [as 别名]
def load_data():
    """ Return the MNIST data as a tuple containing the training data,
    the validation data, and the test data."""
    f = open('../data/mnist.pkl', 'rb')
    training_set, validation_set, test_set = cPickle.load(f)
    f.close()
    return (training_set, validation_set, test_set) 
开发者ID:skylook,项目名称:neural-networks-and-deep-learning,代码行数:9,代码来源:mnist.py

示例6: main

# 需要导入模块: import mnist_loader [as 别名]
# 或者: from mnist_loader import load_data [as 别名]
def main():
    training_data, validation_data, test_data = mnist_loader.load_data()
    # training phase: compute the average darknesses for each digit,
    # based on the training data
    avgs = avg_darknesses(training_data)
    # testing phase: see how many of the test images are classified
    # correctly
    num_correct = sum(int(guess_digit(image, avgs) == digit)
                      for image, digit in zip(test_data[0], test_data[1]))
    print "Baseline classifier using average darkness of image."
    print "%s of %s values correct." % (num_correct, len(test_data[1])) 
开发者ID:skylook,项目名称:neural-networks-and-deep-learning,代码行数:13,代码来源:mnist_average_darkness.py


注:本文中的mnist_loader.load_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。