摘要: 处理流程: 变长特征分割成变长数组 变长数据填充成规则数组,组成n * m的矩阵 (keras.preprocessing.sequence.pad_sequences) 每一行数据进行embedding,结果可以按权重求平均、直接求平均、求最大值 得到 n*1结果矩阵 第3步求平均可以用tf.nn 阅读全文
posted @ 2020-11-27 13:56 oaksharks 阅读(1014) 评论(0) 推荐(0)
摘要: Embedding 就是字典映射,把一个类别映射到一个向量上,方便学习特征。比如对于特征gender有取值有 male,female,创建一个矩阵2*2的矩阵: [[1,2], [3,4]] 把 male 映射到第一行,得到[1,2],female 映射到二行得到[3,4];它与LabelEncod 阅读全文
posted @ 2020-11-27 11:49 oaksharks 阅读(743) 评论(0) 推荐(0)
摘要: tf.concat是把多个tensor合并成一个,合并增加行: import tensorflow as tf tensor_1 = tf.constant([[1, 2], [3, 4], [5, 6]] ) # 2*3 tensor_2 = tf.constant([[7, 8], [9, 10 阅读全文
posted @ 2020-11-26 19:41 oaksharks 阅读(175) 评论(0) 推荐(0)
摘要: gather就是按行取值: a1 = [[1,2], [3, 4], [5, 6]] a2 = tf.gather(tf.constant(a1), [0, 1]) print(a2) 输出: tf.Tensor( [[1 2] [3 4]], shape=(2, 2), dtype=int32) 阅读全文
posted @ 2020-11-26 19:27 oaksharks 阅读(232) 评论(0) 推荐(0)
摘要: 输入不对应 报错内容: WARNING:tensorflow:Model was constructed with shape (None, 79) for input Tensor("genres:0", shape=(None, 79), dtype=float32), but it was c 阅读全文
posted @ 2020-11-26 18:32 oaksharks 阅读(2273) 评论(0) 推荐(0)
摘要: Tensor 在TF中用来存储数据,有点像Spark 中的RDD,用来表示一个集合,里面可能在计算后才有数据,它是TF中常用的数据结构,作为网络层的输入和输出。 把python中的数据变成一个Tensor: import tensorflow as tf print(tf.constant([[1, 阅读全文
posted @ 2020-11-26 18:25 oaksharks 阅读(348) 评论(0) 推荐(0)
摘要: # -*- encoding: utf-8 -*- import tensorflow as tf # 定义一张4单通道*4图片 # data = tf.random.truncated_normal(shape=(1, 1, 4, 4)) data = tf.constant( [[[[1, 2, 阅读全文
posted @ 2020-11-24 10:43 oaksharks 阅读(167) 评论(0) 推荐(0)
摘要: 初始化 默认使用conda activate 命令时会报错,需要给zsh初始化conda配置: conda init zsh 这样默认启动zsh时会会激活一个base虚拟环境,它是把激活命令写到文件.zshrc了。 环境变量的操作 # 删除 conda remove -n your_env_name 阅读全文
posted @ 2020-11-17 15:53 oaksharks 阅读(617) 评论(0) 推荐(0)
摘要: 真阳性率(tpr),正例算对的,越高越好, 假阳性率(fpr),正例算错的,越低越好, 一个好的模型应该tpr很高,fpr很低,这种模型识别正例的能力很强,就用 fpr-tpr得到一个值,如果移动阈值,得到fpr和tpr曲线,找在同一个概率下 tpr和fpr最大的差值作为KS((Kolmogorov 阅读全文
posted @ 2020-11-12 14:26 oaksharks 阅读(2433) 评论(0) 推荐(0)
摘要: 用在可视化进程管理上,作为一个运维工具可以在web页面上查看程序日志、重启程序,并监控状态。 应用场景分析: 开发过程中经常涉及到程序的排错、重启。 重启会在持续集成做,但是需要写脚本,如果基于docker的,通常会: docker rm -f xxx docker run ... 如果是在宿主机上 阅读全文
posted @ 2020-11-12 13:43 oaksharks 阅读(178) 评论(0) 推荐(0)
摘要: npm 是 node package manager,yarn不仅可以管理安装包,还能管理开发环境。 pip 默认就把依赖安装到对应的python目录,它是所有python应用共享一个依赖库,node默认是每个应用独享自己的依赖库,可以避免不同应用的依赖冲突, 类似python给每个应用都创建一个虚 阅读全文
posted @ 2020-11-11 20:20 oaksharks 阅读(283) 评论(0) 推荐(0)
摘要: 转载的,出处找不到了,记录一下: Select Inputs Here the focus is on the quality of your data, specifically the quality of each column of data. You may want to conside 阅读全文
posted @ 2020-09-29 15:08 oaksharks 阅读(145) 评论(0) 推荐(0)
摘要: 方法一: # -*- encoding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt y_score=[2.5710e-05,7.6021e-04,9.9500e-01,4.9876e-04,8.4120e-01,9.99 阅读全文
posted @ 2020-09-14 13:43 oaksharks 阅读(783) 评论(0) 推荐(0)
摘要: 代码: # -*- encoding: utf-8 -*- import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, auc y_score=[2.5710e-05,7.6021e-04,9.9500e-01,4.9 阅读全文
posted @ 2020-09-14 13:38 oaksharks 阅读(193) 评论(0) 推荐(0)
摘要: ps -ef | grep "name" | grep -v grep | awk '{print $2}' | xargs kill -9 阅读全文
posted @ 2020-09-11 19:10 oaksharks 阅读(159) 评论(1) 推荐(1)
摘要: 配置 linux/mac配置文件地址: ~/.pip/pip.conf windows配置地址:%APPDATA%\pip\pip.ini or %HOME%\pip\pip.ini,实测为前者 配置源: [global] timeout = 60 index-url = https://pypi. 阅读全文
posted @ 2020-09-01 12:44 oaksharks 阅读(321) 评论(0) 推荐(0)
摘要: 1. pd.DataFrame 1.1. 获取schema import pandas as pd df = pd.DataFrame(data={"age": [1, 2, 3], "name": ['a', 'b', 'c']}) print(df.dtypes) 输出: age int64 n 阅读全文
posted @ 2020-08-26 20:14 oaksharks 阅读(187) 评论(0) 推荐(0)
摘要: 空值衍生得到的还是空值 代码: import featuretools as ft import pandas as pd df = pd.DataFrame(data={"x1": [None,2,3], 'x2': [4, 5, 6]}) es = ft.EntitySet(id='es_hyp 阅读全文
posted @ 2020-08-26 16:16 oaksharks 阅读(216) 评论(0) 推荐(0)
摘要: 1. 功能说明 有一个测试方法: def test_train(framework): print(framework) assert framework == 'gbm' 希望该方法的framework的值可以通过 pytest的参数传递过来,比如: pytest --framework=deep 阅读全文
posted @ 2020-08-24 16:14 oaksharks 阅读(1616) 评论(0) 推荐(0)
摘要: 这些数据与葡萄牙银行机构在从2008年5月到2010年9月的直接营销活动有关,这些直接营销活动是以电话为基础的。 西班牙银行卖定期存款的,其中y就是表示客户是否会买定期存款。 参数描述: Input variables: # bank client data: 1 - age (numeric) 2 阅读全文
posted @ 2020-08-21 15:34 oaksharks 阅读(1085) 评论(0) 推荐(0)