Skip to main content

flowa - Machine Learning Toolkit

Project description

flowa

flowa - Machine Learning Toolkit

License Python Versions

flowa: (V10.5.5)

Python Machine Learning, Image Generation, Decision Trees, Label Encoders, Sequential, and more!

Installing

# Linux/macOS
python3 pip install -U flowa

# Windows
py -3 -m pip install -U flowa

Simple Examples

x = flowa.Array([[0, 0], [0, 1], [1, 0], [1, 1]])
y = flowa.Array([[0], [1], [1], [0]])

network = flowa.Network(
    flowa.Input(2),
    (
        flowa.Hidden(4, flowa.Tanh), 
        flowa.Hidden(2, flowa.Sigmoid)
    ),
    flowa.Output(1)
)

network.train(x, y, epoch=1000)
print(network.predict(x))
from flowa.ai import (
    Encoder,
    Tree,
    Dataset,
    read_csv,
    convert
)

classifier: Tree = Tree()
encoder: Encoder = Encoder()

dataset: str = convert(Dataset.get_music_data())
csv: object = read_csv(dataset)

dataframe: object = encoder.df(csv, 'gender')

X_matrix: object = dataframe.drop('genre', axis=1).values
y_column: object = encoder(dataframe['genre'].values)

classifier.fit(X_matrix, y_column)

age, gender = encoder.new(30, 'female')
fix: list = encoder.fix(age, gender)

prediction: list[int] = classifier.predict(fix)
print(encoder.inverse(prediction))

#>>> ['Pop']

Image generation:

model: ImageModel[object] = ImageModel()
image: ImageModel[str] = model.generate(
    prompt="a cat", model="pixart", width=512, height=512
).save("some-file.png")

#>>> flowa.types.Image

String Dataset to dataframe conversion:

from flowa.ai import (
    Dataset,
    read_csv,
    convert
)

dataset: Dataset = Dataset.get_play_tennis()

converted_dataset: str = convert(dataset)

csv: Dataset = read_csv(converted_dataset)
print(csv)

#>>>     Outlook Temperature Humidity    Wind Play Tennis
#>>> 0  Overcast        Mild   Normal    Weak         Yes
#>>> 1     Sunny        Mild   Normal    Weak         Yes
#>>> ... [2 rows not shown]

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flowa-10.5.5.tar.gz (182.4 kB view hashes)

Uploaded Source

Built Distribution

flowa-10.5.5-py3-none-any.whl (17.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page