社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  机器学习算法

机器学习应用区块链系列(一)——如何开发一套自己的智能合约系统

量化投资与机器学习 • 6 年前 • 432 次点击  



从今天开始

编辑部将带来机器学习应用区块链系列


由于是第一期,我们想解读一些国外已有的文献和研究。故带来了START-Summit-2017-Blockchain-Machine-Learning-Workshop的演讲稿和示例代码,希望能够给大家带来一些启迪。


介绍

代码的目的是用一个简单的例子来演示如何把区块链技术,智能合约和机器学习结合在一起。 (代码在文末下载)


代码文件


- runTestnet.sh: launches a local development Blockchain for easy testing
- contract.sol: contains the smart contract code in solidity language
- installContract.py: Python script for sending our contract to the Blockchain
- user.py: Python script that contains the actual chat client
- classify.py: Python script to classifiy an image file


流程

推荐使用Linux系统。 安装将集中在Ubuntu Linux 16.04 LTS上,但对于其他发行版应该是类似的。


我们需要先安装Python 2.7,pip,curl和git:


open a Linux Terminal and enter the following command:
sudo apt-get install python2.7 python-pip curl git build-essential libssl-dev


安装当前nodejs版本:

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs


安装区块链测试环境:


sudo npm install -g ethereumjs-testrpc solc


安装其他Python包:

sudo pip install -U pip
sudo pip install -U numpy keras==2.0.0 tensorflow ethjsonrpc h5py Pillow scipy


克隆workshop代码:

cd
git clone https://github.com/thoschm/START-Summit-2017-Blockchain-Machine-Learning-Workshop.git workshop_code


克隆现成的深度学习模型:

cd
git clone https://github.com/fchollet/deep-learning-models.git
cp deep-learning-models/resnet50.py workshop_code/code/
cp deep-learning-models/imagenet_utils.py workshop_code/code/



简单的图像分类示例

cd
cd workshop_code/code
[get some image file in there]
python classify.py image.jpg


当您第一次运行它时,它会从互联网下载预先训练的网络权重。 不需要自己训练。


Using TensorFlow backend.
content:

Downloading data from https://s3.amazonaws.com/deep-learning-models/image-models/imagenet_class_index.json
>  tree_frog  <


PPT展示



获取本系列代码+论文

请在后台回复

区块链1

即可获取

有些人不知道后台回复如何操作

为大家介绍一下:


今天看啥 - 高品质阅读平台
本文地址:http://www.jintiankansha.me/t/mCCrh2klTl
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/5494
 
432 次点击