小编Ale*_*der的帖子

Catboost是否支持python3?

我想使用catboost最近由Yandex发布给开源社区的项目.但是,我在我的项目中使用Python 3.我知道Python 3是由Yandex皇帝禁止的.是否catboost支持Python 3里?

python-3.x yandex catboost

14
推荐指数
1
解决办法
1565
查看次数

如何在Anaconda x64上安装Yandex CatBoost?

我成功安装了CatBoost

pip install catboost
Run Code Online (Sandbox Code Playgroud)

但是当我在Jupiter Notebook中尝试使用示例python脚本时,我遇到了错误

import numpy as np
from catboost import CatBoostClassifier

ImportError: No module named '_catboost'
ImportError: DLL load failed: ?? ?????? ????????? ??????.
Run Code Online (Sandbox Code Playgroud)

链接到CatBoost网站:https://catboost.yandex/

python yandex anaconda catboost

7
推荐指数
2
解决办法
5576
查看次数

会话恢复后,get_variable()不起作用

我尝试恢复会话并调用get_variable()以获取类型为tf.Variable的对象(根据此答案).它无法找到变量.重现案例的最小例子如下.

首先,创建一个变量并保存会话.

import tensorflow as tf

var = tf.Variable(101)

with tf.Session() as sess:
    with tf.variable_scope(''):
        scoped_var = tf.get_variable('scoped_var', [])

    with tf.variable_scope('', reuse=True):
        new_scoped_var = tf.get_variable('scoped_var', [])

    assert scoped_var is new_scoped_var
    sess.run(tf.global_variables_initializer())
    saver = tf.train.Saver()
    print(sess.run(scoped_var))
    saver.save(sess, 'data/sess')
Run Code Online (Sandbox Code Playgroud)

这里get_variables有一个reuse=True工作正常的范围.然后,从文件中恢复会话并尝试获取变量.

import tensorflow as tf

with tf.Session() as sess:
    saver = tf.train.import_meta_graph('data/sess.meta')
    saver.restore(sess, 'data/sess')

    for v in tf.get_collection('variables'):
        print(v.name)

    print(tf.get_collection(("__variable_store",)))
    # Oops, it's empty!

    with tf.variable_scope('', reuse=True):
        # the next line fails
        new_scoped_var = tf.get_variable('scoped_var', …
Run Code Online (Sandbox Code Playgroud)

tensorflow

5
推荐指数
1
解决办法
664
查看次数

张量流中的变量内部

我将探讨如何在图中表示变量.我创建一个变量,初始化它并在每个动作后创建图形快照:

import tensorflow as tf

def dump_graph(g, filename):
    with open(filename, 'w') as f:
        print(g.as_graph_def(), file=f)

g = tf.get_default_graph()
var = tf.Variable(2)
dump_graph(g, 'data/after_var_creation.graph')

init = tf.global_variables_initializer()
dump_graph(g, 'data/after_initializer_creation.graph')

with tf.Session() as sess:
    sess.run(init)
    dump_graph(g, 'data/after_initializer_run.graph')
Run Code Online (Sandbox Code Playgroud)

变量创建后的图形看起来像

node {
  name: "Variable/initial_value"
  op: "Const"
  attr {
    key: "dtype"
    value {
      type: DT_INT32
    }
  }
  attr {
    key: "value"
    value {
      tensor {
        dtype: DT_INT32
        tensor_shape {
        }
        int_val: 2
      }
    }
  }
}
node {
  name: "Variable"
  op: "VariableV2"
  attr {
    key: …
Run Code Online (Sandbox Code Playgroud)

tensorflow

4
推荐指数
1
解决办法
1879
查看次数

标签 统计

catboost ×2

tensorflow ×2

yandex ×2

anaconda ×1

python ×1

python-3.x ×1