Skip to content

Latest commit

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

KerasWrapper

Keras 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:

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

inputs := {{0 . 0}.
{0 . 1}.
{1 . 0}.
{1 . 1}}.
expectedOutputs := {0 . 1 . 1 . 0}.
model :=KNSequentialModelinputDim:2.
model add: (KNDenseLayerneurons:8).
model add:KNTanHActivationnew.
model add: (KNDenseLayerneurons:1).
model add:KNSigmoidActivationnew.
model compileLoss:KNBinaryCrossentropyLossnewoptimizer: (KNSGDOptimizernewlearningRate:0.1).
fitData := (model
fit: inputs
labels: expectedOutputs
epochs:200) waitForValue.

Evaluating the code produce the following: simple xor

The Pharo code given above is inspired from the pure python version

About

Keras bindings for Pharo

Resources

Stars

9 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors