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


Python base.load_iris方法代码示例

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


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

示例1: testClassification

# 需要导入模块: from tensorflow.contrib.learn.python.learn.datasets import base [as 别名]
# 或者: from tensorflow.contrib.learn.python.learn.datasets.base import load_iris [as 别名]
def testClassification(self):
    """Tests multi-class classification using matrix data as input."""
    hparams = tensor_forest.ForestHParams(
        num_trees=3,
        max_nodes=1000,
        num_classes=3,
        num_features=4,
        split_after_samples=20)
    classifier = random_forest.TensorForestEstimator(hparams.fill())

    iris = base.load_iris()
    data = iris.data.astype(np.float32)
    labels = iris.target.astype(np.float32)

    classifier.fit(x=data, y=labels, steps=100, batch_size=50)
    classifier.evaluate(x=data, y=labels, steps=10) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:18,代码来源:random_forest_test.py

示例2: iris_input_fn

# 需要导入模块: from tensorflow.contrib.learn.python.learn.datasets import base [as 别名]
# 或者: from tensorflow.contrib.learn.python.learn.datasets.base import load_iris [as 别名]
def iris_input_fn():
  iris = base.load_iris()
  features = tf.reshape(tf.constant(iris.data), [-1, _IRIS_INPUT_DIM])
  labels = tf.reshape(tf.constant(iris.target), [-1])
  return features, labels 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:7,代码来源:debug_tflearn_iris.py

示例3: prepare_iris_data_for_logistic_regression

# 需要导入模块: from tensorflow.contrib.learn.python.learn.datasets import base [as 别名]
# 或者: from tensorflow.contrib.learn.python.learn.datasets.base import load_iris [as 别名]
def prepare_iris_data_for_logistic_regression():
  # Converts iris data to a logistic regression problem.
  iris = base.load_iris()
  ids = np.where((iris.target == 0) | (iris.target == 1))
  return base.Dataset(data=iris.data[ids], target=iris.target[ids]) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:7,代码来源:test_data.py

示例4: iris_input_multiclass_fn

# 需要导入模块: from tensorflow.contrib.learn.python.learn.datasets import base [as 别名]
# 或者: from tensorflow.contrib.learn.python.learn.datasets.base import load_iris [as 别名]
def iris_input_multiclass_fn():
  iris = base.load_iris()
  return {
      'feature': constant_op.constant(
          iris.data, dtype=dtypes.float32)
  }, constant_op.constant(
      iris.target, shape=(150, 1), dtype=dtypes.int32) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:9,代码来源:test_data.py

示例5: testClassificationTrainingLoss

# 需要导入模块: from tensorflow.contrib.learn.python.learn.datasets import base [as 别名]
# 或者: from tensorflow.contrib.learn.python.learn.datasets.base import load_iris [as 别名]
def testClassificationTrainingLoss(self):
    """Tests multi-class classification using matrix data as input."""
    hparams = tensor_forest.ForestHParams(
        num_trees=3, max_nodes=1000, num_classes=3, num_features=4)
    classifier = random_forest.TensorForestEstimator(
        hparams, graph_builder_class=(tensor_forest.TrainingLossForest))

    iris = base.load_iris()
    data = iris.data.astype(np.float32)
    labels = iris.target.astype(np.float32)

    monitors = [random_forest.TensorForestLossHook(10)]
    classifier.fit(x=data, y=labels, steps=100, monitors=monitors)
    classifier.evaluate(x=data, y=labels, steps=10) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:16,代码来源:random_forest_test.py


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