tensorflow

Keras: .predict returns percentages instead of classes

时光总嘲笑我的痴心妄想 提交于 2021-02-13 17:39:23
问题 I am building a model with 3 classes: [0,1,2] After training, the .predict function returns a list of percentages instead. I was checking the keras documentation but could not figure out, what I did wrong. .predict_classes is not working anymore, and I did not have this problem with previous classifiers. I already tried different activation functions (relu, sigmoid etc.) If I understand correctly, the number in Dense(3...) defines the amount of classes. outputs1=Dense(3,activation='softmax')

Keras: .predict returns percentages instead of classes

筅森魡賤 提交于 2021-02-13 17:38:59
问题 I am building a model with 3 classes: [0,1,2] After training, the .predict function returns a list of percentages instead. I was checking the keras documentation but could not figure out, what I did wrong. .predict_classes is not working anymore, and I did not have this problem with previous classifiers. I already tried different activation functions (relu, sigmoid etc.) If I understand correctly, the number in Dense(3...) defines the amount of classes. outputs1=Dense(3,activation='softmax')

Linkedin TonY

懵懂的女人 提交于 2021-02-13 16:43:50
背景说明:TensorFlowOnYARN开源时间较早,目前作者已经停止维护,业内推荐TonY系统; 安装环境:Centos 7.0或以上,物理机,Python-2.7.5虚拟环境(默认),tensorflow-1.13.1; 下载地址: https://github.com/linkedin/TonY ,git clone https://github.com/linkedin/TonY.git; 组件安装:apt-get update,apt-get install wget,apt-get install vim,apt-get install git,上传jdk,编辑.bashrc配置java环境; 代码编译:./gradlew build或./gradlew build -x test,前者构建并测试,后者只构建不测试,目标文件位于./tony-cli/build/libs/路径下; 目标文件: root@b9683a1b9302:~/TonY/tony-cli/build/libs# ll -h total 29M drwxr-xr-x 2 root root 4.0K Nov 4 03:17 ./ drwxr-xr-x 9 39040 staff 4.0K Nov 4 03:01 ../ -rw-r--r-- 1 root root 29M Nov 4 03:17

自己动手写一个印钞机 第二章

房东的猫 提交于 2021-02-13 16:39:34
作者:阿布🐶 未经本人允许禁止转载 ipython notebook git版本 目录章节地址: 自己动手写一个印钞机 第一章 自己动手写一个印钞机 第二章 自己动手写一个印钞机 第三章 自己动手写一个印钞机 第四章 自己动手写一个印钞机 第五章 自己动手写一个印钞机 第六章 自己动手写一个印钞机 第七章 简书目录章节地址: 自己动手写一个印钞机 第一章 自己动手写一个印钞机 第二章 自己动手写一个印钞机 第三章 自己动手写一个印钞机 第四章 自己动手写一个印钞机 第五章 自己动手写一个印钞机 第六章 自己动手写一个印钞机 第七章 自己动手写一个印钞机 附录章 股票量化专题地址,请关注,谢谢! 非均衡胜负收益带来的必然非均衡胜负比例,目标由因子的能力解决一部分,模式识别提升关键的一部分 本章开始说文章的核心了, 模式识别提升关键的一部分 本章的内容主要是通过机器学习如svm,随机森林等对stock模式识别的初步探索,俗称罪恶的第一步,但还是要坚定的卖出,毕竟目标是印钞机 下面运行因子对多年数据进行回测,模式识别中基本的需求就是生成训练集数据与测试集数据,对训练集的数据抽取特质,总结规律,在测试集上指导交易,与没有指导交易的测试集进行比对,查看效果。 BuyGoldenFactor.g_enable_filter_ml = True # 回测因子的历史且结果集加入机器学习需要的数据

20种小技巧,玩转Google Colab

China☆狼群 提交于 2021-02-13 07:30:28
选自amitness.com 作者:Amit Chaudhary 机器之心编译 编辑:陈萍 Google Colab 给广大的 AI 开发者提供了免费的 GPU,你可以在上面轻松地跑 Tensorflow、Pytorch 等深度学习框架。但关于 Colab 的使用技巧你又掌握了多少呢?这篇文章将介绍 20 种 Colab 使用技巧,帮你提高使用效率。 1. 便签本 Notebook 当我们在 colab 上尝试一些临时的东西时,我们会创建一堆杂乱、没有标题的 Notebook。 为了解决这个问题,你可以把以下链接加入书签:https://colab.research.google.com/notebooks/empty.ipynb 这将打开一个特殊的 scratch notebook,并且你对该 notebook 所做的任何更改都不会保存到你的主目录中。 2. 单元计时 通常,我们手动计算一段代码的开始时间和结束时间之间的差值来衡量所花费的时间。Colab 提供了内置功能来执行此操作。在执行了一个单元(cell)之后,将鼠标悬停在单元运行图标上,你将获得代码执行时间的估计值。 3. 运行某个单元的一部分 你也可以运行某个单元的一部分,通过选择单元格并点击 Runtime 索引到 Run Selection 按钮或使用键盘快捷键 Ctrl + Shift + Enter。 4.

Save keras model as .h5

余生长醉 提交于 2021-02-12 11:38:53
问题 I want to save my trained keras model as .h5 file. Should be straight forward. Short example: #%% import tensorflow as tf import numpy as np from tensorflow.keras.callbacks import ModelCheckpoint import matplotlib.pyplot as plt print('TF version: ',tf.__version__) #%% ######################### # BATCH SIZE BATCH_SIZE=100 ######################## # create training data X_train_set = np.random.random(size=(10000,10)) y_train_set = np.random.random(size=(10000)) # create validation data X_val

为什么大公司要开源自己的技术?

[亡魂溺海] 提交于 2021-02-11 20:57:00
大约一个月前,谷歌公开了用于Big Transfer(BiT)的预训练模型和微调代码——Big Transfer是一种深度学习的计算机视觉模型。根据谷歌的说法,Big Transfer将允许任何人在相应的任务上达到最优表现,即使每个类只有少量的标签图片。这仅仅是这家科技巨头免费向公众开放其专有产品的一个例子。要知道,发布强大的免费开源软件已经成为科技界的常见事件,并引发了这样一个问题:大型科技公司这么做得到了什么回报? 在90年代后期,当Open Source Initiative出现时,将源代码公开的想法被认为是一个坏策略,因为专有软件是标准,公司会尽一切努力保护软件。到2020年,开源的概念发生了巨大的变化,现在已经成为主流。 如今有许多开源技术公司,其中一些公司的年收入已经超过1亿美元(甚至10亿美元),包括红帽、MongoDB、Cloudera、MuleSoft、Hashicorp、Databricks(Spark)和Confluent(Kafka)。 除了上述科技公司高调收购和投资开源项目外,谷歌和Facebook等科技巨头也把开源放到了难以置信的重要位置,因为开源对于收集新产品的创新和建立一个庞大的开发者社区非常重要。例如,Flutter vs React Native、Tensorflow vs PyTorch、Kubernetes等

How to handle errors in arrays and sequence?

左心房为你撑大大i 提交于 2021-02-11 18:21:32
问题 I am trying to find the similarity of documents. Referring to this github repo: https://github.com/s4sarath/Deep-Learning-Projects/blob/master/variational_text_inference/model_evaluation.ipynb When I run this code: batch_size = 100 H_20_grp_nws = [] batch_data = A.get_batch(batch_size) batch_id = 0 for batch_ in batch_data: batch_id += 1 collected_data = [chunks for chunks in batch_] batch_xs , mask_xs , mask_negative = A._bag_of_words(collected_data) feed_dict = {vae.X: batch_xs , vae

Two versions of python in one computer

南楼画角 提交于 2021-02-11 18:16:11
问题 I have Pyhton 3.8 (32-bit) in my computer, I use Pycharm and also jupyter notebook. I need to install Python 3.6 (64-bit) because I need to work with tensorflow and it only works with Python 3.6(64-bit) Can I have two versions of python together? And How can change and work with two python versions in pycharm and jupyter? 回答1: The preferred way to use python virtual environments now is venv. You can install any number of python versions on your windows, though please also install the py

How to fix flatlined accuracy and NaN loss in tensorflow image classification

心已入冬 提交于 2021-02-11 18:05:34
问题 I am currently experimenting with TensorFlow and machine learning, and as a challenge, I decided to try and code a machine learning software, on the Kaggle website, that can analyze brain MRI scans and predict if a tumour exists or not. I did so with the code below and began training the model. However, the text that showed up during training showed that none of the loss values (training or validation) had proper values and that the accuracies flatlined, or fluctuated between two numbers (the