日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

[机器学习]AutoML --- AutoKeras

發布時間:2023/12/15 编程问答 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [机器学习]AutoML --- AutoKeras 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

前 言

? ? ? ?
? ? ? ? Keras 是一個用 Python 編寫的高級神經網絡 API,能夠在 TensorFlow、CNTK 或 Theano 之上運行。它的意義在于可以實現快速實驗。而能夠以最小的延遲把想法變成結果是順利進行研究的關鍵。

???????? AutoKeras是一個開源的,基于 Keras 的新型 AutoML 庫。AutoKeras 是一個用于自動化機器學習的開源軟件庫,提供自動搜索深度學習模型的架構和超參數的功能。AutoKeras 采用的架構搜索方法是一種結合了貝葉斯優化的神經架構搜索。它主要關注于降低架構搜索所需要的計算力,并提高搜索結果在各種任務上的性能。

官方網站:https://autokeras.com/
項目github:https://github.com/jhfjhfj1/autokeras


TensorFlow版本:https://github.com/melodyguan/enas
PyTorch 版本:https://github.com/carpedm20/ENAS-pytorch

?

安裝Auto-keras

?

Note:?currently, Auto-Keras is only compatible with:?Python 3.6.

1? Auto-Keras依賴于Keras, Pytorch, Tensorflow組件,打開Anconda Prompt,輸入以下命令:

pip install keras pip install install pytorch pip install tensorflow-gpu

等待安裝完畢即可。

2? 安裝graphviz
此依賴包的目的是為了繪制Auto-Keras生成的網絡結構,同樣的輸入以下命令:

pip install graphviz

3. 安裝Auto-Keras
最后來安裝Auto-Keras,輸入命令:

pip?install ?autokeras

?

Docker Env

?

1. Download Auto-Keras Docker image

docker pull garawalid/autokeras

2. Start Auto-Keras Docker container

docker run -it --shm-size 2G garawalid/autokeras /bin/bash

In case you need more memory to run the container, change the value of?shm-size. (Docker run reference)

3. Run application :

To run a local script?file.py?using Auto-Keras within the container, mount the host directory?-v hostDir:/app.

docker run -it -v hostDir:/app --shm-size 2G garawalid/autokeras python file.py

Example :

Let's download the mnist example and run it within the container.

wget https://raw.githubusercontent.com/jhfjhfj1/autokeras/master/examples/mnist.py

Run the mnist example :

docker run -it -v "$(pwd)":/app --shm-size 2G garawalid/autokeras python mnist.py

?

K8S?Env

1. specifies the tmpfs volume dshm.
2. enables POSIX shared memory for hello-container1 via dshm.

https://docs.okd.io/latest/dev_guide/shared_memory.html

apiVersion: v1 id: hello-autokeras kind: Pod metadata:name: hello-autokeraslabels:name: hello-autokeras spec:volumes: - name: dshmemptyDir:medium: Memorycontainers:- image: garawalid/autokerasname: hello-container1ports:- containerPort: 8080hostPort: 6061volumeMounts: - mountPath: /dev/shmname: dshm

?

Create the pod using the?shared-memory.yaml?file:

$ kubelet create -f autokeras.yaml

Auto-Keras 使用示例

from keras.datasets import mnist from autokeras import ImageClassifierif __name__ == '__main__':(x_train, y_train), (x_test, y_test) = mnist.load_data()x_train = x_train.reshape(x_train.shape+(1,))x_test = x_test.reshape(x_test.shape+(1,))clf = ImageClassifier(verbose=True, augment=False)clf.fit(x_train, y_train, time_limit=30 * 60)clf.final_fit(x_train, y_train, x_test, y_test, retrain=True)y = clf.evaluate(x_test, y_test)print(y * 100)clf.load_searcher().load_best_model().produce_keras_model().save('\my_model.h5')

?

運行代碼,顯示Auto-Keras正在不斷進行迭代以尋找最優網絡:

?

?

參考: https://towardsdatascience.com/auto-keras-or-how-you-can-create-a-deep-learning-model-in-4-lines-of-code-b2ba448ccf5e

?

?

?

總結

以上是生活随笔為你收集整理的[机器学习]AutoML --- AutoKeras的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。