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


Python Loader.load_dataset方法代码示例

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


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

示例1: knn

# 需要导入模块: from loader import Loader [as 别名]
# 或者: from loader.Loader import load_dataset [as 别名]
        if args.kmeans:
            if args.kmeansk:
                self.choices[0] = ("kmeans", args.kmeansk)
            else:
                self.choices[0] = ("kmeans", [])

        if args.knn:
            if args.knnk:
                self.choices[1] = ("knn", args.knnk)
            else:
                self.choices[1] = ("knn", [])

        self.run_prediction()

        sys.exit()

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Choose the algorithms to test on handwritten digit recognition.")
    parser.add_argument("-m", "--kmeans", help="Run kmeans", action = "store_true")
    parser.add_argument("-n","--knn", help="Run knn, if no k-value specified, default is used", action = "store_true")
    parser.add_argument("-nk", "--knnk", metavar='N', type=int, nargs='+',help= "Choose k-values for knn (type -nk # # #)")
    parser.add_argument("-mk", "--kmeansk", metavar='N', type=int, choices = [10,15,20],help= "Choose k-values for kmeans (type -mk # # #) (choose from 10,15,20)")
    args = parser.parse_args()
    if not(args.kmeans or args.knn):
        parser.print_help()
    else:
        load = Loader("testing")
        images, labels = load.load_dataset()
        PredictionRunner(args, images, labels)
开发者ID:wendywoodin,项目名称:CS51-final-project,代码行数:31,代码来源:main.py

示例2: Loader

# 需要导入模块: from loader import Loader [as 别名]
# 或者: from loader.Loader import load_dataset [as 别名]
import numpy as np
from loader import Loader
import matplotlib.pyplot as plt

load = Loader("testing")

# Load in the digits from the dataset, each in their own array
zeros, labels = load.load_dataset([0])
ones, labels = load.load_dataset([1])
twos, labels = load.load_dataset([2])
threes, labels = load.load_dataset([3])
fours, labels = load.load_dataset([4])
fives, labels = load.load_dataset([5])
sixes, labels = load.load_dataset([6])
sevens, labels = load.load_dataset([7])
eights, labels = load.load_dataset([8])
nines, labels = load.load_dataset([9])


# Find the minimum number of digits so we don't go outside
# the bounds of the array
lengths = [len(zeros),len(ones),len(twos),len(threes),\
    len(fours),len(fives),len(sixes),len(sevens),len(eights)]

length = min(lengths)


# Set up checking for similarity level between the same digits
sim0 = []
sim1 = []
sim2 = []
开发者ID:wendywoodin,项目名称:CS51-final-project,代码行数:33,代码来源:dataset_analysis.py


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