Skip to main content

A splinters to scripts generator

Project description

Optibot

Create splinters like this

{{ optiid("splinter1") }}

{{ optitask("model") }}
{{ optitask("train") }}
{{ optitask("classification") }}

{{ optiimport("from sklearn.ensemble import RandomForestClassifier")}}

{{ optivar("model")}}
{{ optivar("X")}}
{{ optivar("y")}}

{{ optiparam("n_estimators", "int", min=0, max=100) }}
{{ optiparam("random_state", "int", min=0, max=40000) }}

---

# Train a Lasso model with alpha=0.1
{{model}} = RandomForestClassifier(n_estimators={{n_estimators}}, random_state={{random_state}})
{{model}}.fit({{X}}, {{y}})


Use them in scripts templates like this

import numpy as np
{{ imports() }}

# Load data from CSV file using NumPy
data = np.loadtxt("data.csv", delimiter=",")

# Split the data into features (X) and labels (y)
features = data[:, :-1]
labels = data[:, -1]

# Train a classifier
{{ splinter("train", "model.train.classification", X="features", y="labels", model="clf") }}

# Test the trained classifier
score = clf.score(features, labels)
print("Accuracy: {:.2f}%".format(score * 100))

Generate random scripts with them

from src.optibot.core.optibot import OptiBot

bot = OptiBot()
bot.preload_splinters_from_path("./templates/splinters/*")
bot.preload_templates_from_path("./templates/scripts/*")
bot.compile()

for x in range(10):
    subject = list(bot.generate_script())

    with open(f"subject_{x + 1}.py", "w") as fp:
        fp.write(bot.render("simple.jinja", subject))

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

optibot-0.0.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

optibot-0.0.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file optibot-0.0.2.tar.gz.

File metadata

  • Download URL: optibot-0.0.2.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for optibot-0.0.2.tar.gz
Algorithm Hash digest
SHA256 98ba09c57b5157e77cba2f4c15c7fa1d97b950b9c427b238aa08c144002a279f
MD5 0ab8631bcb5bdf332f07718b917462c5
BLAKE2b-256 a39fcaaf5e6bd0e9cab2778cbb41d1f390aa30b16ac75c08fc01bf1cdd022ab7

See more details on using hashes here.

File details

Details for the file optibot-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: optibot-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.2

File hashes

Hashes for optibot-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 34064d4f483a01191472fbf5caadf32836c261e469a3666ca8016158b07628c0
MD5 60619186ba9dd35950cfdd823dec3a1c
BLAKE2b-256 7a9ffcf62ffab73a438cae624b4225c3334d04d8c0969c176848e961e986861d

See more details on using hashes here.

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