Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ObjectProfile/KerasWrapper
Keras bindings for Pharo
https://github.com/ObjectProfile/KerasWrapper
Last synced: 3 months ago
JSON representation
Keras bindings for Pharo
- Host: GitHub
- URL: https://github.com/ObjectProfile/KerasWrapper
- Owner: ObjectProfile
- License: mit
- Created: 2018-03-16T13:23:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-29T22:41:03.000Z (10 months ago)
- Last Synced: 2024-04-22T03:52:51.537Z (7 months ago)
- Size: 131 KB
- Stars: 9
- Watchers: 8
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-pharo - Keras Wrapper - Allows to use [Keras](https://keras.io/) functions within Pharo. (Artificial Intelligence and Machine Learning)
- awesome-pharo-ml - Keras bindings - allows to use [Keras](https://keras.io/) functions within Pharo (Deep Learning)
README
# KerasWrapper
[Keras](https://keras.io) bindings for Pharo. This binding allows to use Keras (implemented in Python) within Pharo. For the Pharo programmer, the fact that Keras is written in Python is completely transparent.# Installing KerasWrapper
The following code loads the KerasWrapper in Pharo:
```Smalltalk
Gofer it
smalltalkhubUser: 'ainfante' project: 'Keras-Wrapper';
configurationOf: 'KerasWrapper';
loadDevelopment.
```You then needs to install Python, TensorFlow, and Keras. In the help menu, we provide detalled instruction on how to do so.
# Simple Example
Here is the XOR simple example in Pharo
```Smalltalk
inputs := {{0 . 0}.
{0 . 1}.
{1 . 0}.
{1 . 1}}.
expectedOutputs := {0 . 1 . 1 . 0}.
model := KNSequentialModel inputDim: 2.
model add: (KNDenseLayer neurons: 8).
model add: KNTanHActivation new.
model add: (KNDenseLayer neurons: 1).
model add: KNSigmoidActivation new.
model compileLoss: KNBinaryCrossentropyLoss new optimizer: (KNSGDOptimizer new learningRate: 0.1).
fitData := (model
fit: inputs
labels: expectedOutputs
epochs: 200) waitForValue.
```Evaluating the code produce the following:
![simple xor](img/simpleXOR.png)The Pharo code given above is inspired from the [pure python version](https://gist.github.com/stewartpark/187895beb89f0a1b3a54)