python
西班牙没馅饼
这个作者很懒,什么都没留下…
展开
-
keras模型加载 Unknown Layer
存储模型train.py: model.save('model_weight.h5')在predict.py中,使用model = load_model("model_weight.h5")对模型进行加载的时报错信息:Unknown Layer:LayerName。此处的LayerName代指自定义的layer。 global name 'tf' is not defined正...原创 2020-04-02 16:39:36 · 1614 阅读 · 0 评论 -
pandas对每列数据(离散特征)进行编码
PATH_TO_DATA = 'XXX'data = pd.read_csv(PATH_TO_DATA, sep='\t', header=None)data.columns = ['UId', 'ItemId', 'BrandId', 'MiddlesortId', 'ClickTime', 'Date']data = data[['UId', 'ItemId', 'BrandId', '...原创 2020-03-18 12:42:52 · 1409 阅读 · 1 评论 -
Python Networkx 包常用的方法函数
找子节点: DiGraph.successors(n) Return a list of successor nodes of n. 找父节点:DiGraph.predecessors(n) Return a list of predecessor nodes of n. 求距离某一节点(0)的最短路径: nx.shortest_path_length(G, 0, node)原创 2017-12-10 19:51:48 · 3355 阅读 · 1 评论 -
python 统计list中各个元素出现的次数
python 统计list中各个元素出现的次数利用Python字典统计利用Python的collection包下Counter的类统计利用Python的pandas包下的value_counts的类统计利用字典dict来完成统计举例:a = [1, 2, 3, 1, 1, 2]dict = {}for key in a: dict[key] = dict.get(key, 0)原创 2017-09-10 21:04:43 · 181466 阅读 · 11 评论 -
TensorFlow入门代码--识别手写数字
#!/usr/bin/env python# -*- coding: utf-8 -*-"""@Time : 2018/4/28 11:22@Author : Junya Lu@Site : 多层感知机识别数字"""from tensorflow.examples.tutorials.mnist import input_dataimport tensorflow a...原创 2018-04-27 15:09:27 · 513 阅读 · 0 评论 -
TensorFlow实现自编码器
#!/usr/bin/env python# -*- coding: utf-8 -*-"""@Time : 2018/4/27 15:29@Author : Junya Lu@Site : """import tensorflow as tfimport numpy as npimport sklearn.preprocessing as prepfrom te...原创 2018-04-28 11:19:57 · 175 阅读 · 0 评论