Skip to main content

Science as data transformation

Project description

test codecov

aiuna scientific data for the classroom

WARNING: This project is still subject to major changes, e.g., in the next rewrite.

Bradypus variegatus - By Stefan Laube - (Dreizehenfaultier (Bradypus infuscatus), Gatunsee, Republik Panama), Public Domain

Installation

Examples

Creating data from ARFF file

from aiuna import *

d = file("iris.arff").data

print(d.Xd)
"""
['sepallength', 'sepalwidth', 'petallength', 'petalwidth']
"""
print(d.X[:5])
"""
[[5.1 3.5 1.4 0.2]
 [4.9 3.  1.4 0.2]
 [4.7 3.2 1.3 0.2]
 [4.6 3.1 1.5 0.2]
 [5.  3.6 1.4 0.2]]
"""
print(d.y[:5])
"""
['Iris-setosa' 'Iris-setosa' 'Iris-setosa' 'Iris-setosa' 'Iris-setosa']
"""
from pandas import DataFrame
print(DataFrame(d.y).value_counts())
"""
Iris-setosa        50
Iris-versicolor    50
Iris-virginica     50
dtype: int64
"""

cessing a data field as a pandas DataFrame

#from aiuna import *

#d = dataset.data  # 'iris' is the default dataset
#df = d.X_pd
#print(df.head())
#...

#mycol = d.X_pd["petal length (cm)"]
#print(mycol[:5])
#...

Creating data from numpy arrays

from aiuna import *
import numpy as np

X = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
y = np.array([0, 1, 1])
d = new(X=X, y=y)
print(d)
"""
{
    "uuid": "06NLDM4mLEMrHPOaJvEBqdo",
    "uuids": {
        "changed": "3Sc2JjUPMlnNtlq3qdx9Afy",
        "X": "13zbQMwRwU3WB8IjMGaXbtf",
        "Y": "1IkmDz3ATFmgzeYnzygvwDu"
    },
    "step": {
        "id": "06NLDM4mLEMrHPOT2pd5lzo",
        "desc": {
            "name": "New",
            "path": "aiuna.step.new",
            "config": {
                "hashes": {
                    "X": "586962852295d584ec08e7214393f8b2",
                    "Y": "f043eb8b1ab0a9618ad1dc53a00d759e"
                }
            }
        }
    },
    "changed": [
        "X",
        "Y"
    ],
    "X": [
        "[[1 2 3]",
        " [4 5 6]",
        " [7 8 9]]"
    ],
    "Y": [
        "[[0]",
        " [1]",
        " [1]]"
    ]
}
"""

Checking history

from aiuna import *

d = dataset.data  # 'iris' is the default dataset
print(d.history)
"""
{
    "02o8BsNH0fhOYFF6JqxwaLF": {
        "name": "New",
        "path": "aiuna.step.new",
        "config": {
            "hashes": {
                "X": "19b2d27779bc2d2444c11f5cc24c98ee",
                "Y": "8baa54c6c205d73f99bc1215b7d46c9c",
                "Xd": "0af9062dccbecaa0524ac71978aa79d3",
                "Yd": "04ceed329f7c3eb43f93efd981fde313",
                "Xt": "60d4f429fcd642bbaf1d976002479ea2",
                "Yt": "4660adc31e2c25d02cb751dcb96ecfd3"
            }
        }
    }
}
"""
del d["X"]
print(d.history)
"""
{
    "02o8BsNH0fhOYFF6JqxwaLF": {
        "name": "New",
        "path": "aiuna.step.new",
        "config": {
            "hashes": {
                "X": "19b2d27779bc2d2444c11f5cc24c98ee",
                "Y": "8baa54c6c205d73f99bc1215b7d46c9c",
                "Xd": "0af9062dccbecaa0524ac71978aa79d3",
                "Yd": "04ceed329f7c3eb43f93efd981fde313",
                "Xt": "60d4f429fcd642bbaf1d976002479ea2",
                "Yt": "4660adc31e2c25d02cb751dcb96ecfd3"
            }
        }
    },
    "06fV1rbQVC1WfPelDNTxEPI": {
        "name": "Del",
        "path": "aiuna.step.delete",
        "config": {
            "field": "X"
        }
    }
}
"""
d["Z"] = 42
print(d.Z, type(d.Z))
"""
[[42]] <class 'numpy.ndarray'>
"""
print(d.history)
"""
{
    "02o8BsNH0fhOYFF6JqxwaLF": {
        "name": "New",
        "path": "aiuna.step.new",
        "config": {
            "hashes": {
                "X": "19b2d27779bc2d2444c11f5cc24c98ee",
                "Y": "8baa54c6c205d73f99bc1215b7d46c9c",
                "Xd": "0af9062dccbecaa0524ac71978aa79d3",
                "Yd": "04ceed329f7c3eb43f93efd981fde313",
                "Xt": "60d4f429fcd642bbaf1d976002479ea2",
                "Yt": "4660adc31e2c25d02cb751dcb96ecfd3"
            }
        }
    },
    "06fV1rbQVC1WfPelDNTxEPI": {
        "name": "Del",
        "path": "aiuna.step.delete",
        "config": {
            "field": "X"
        }
    },
    "05eIWbfCJS7vWJsXBXjoUAh": {
        "name": "Let",
        "path": "aiuna.step.let",
        "config": {
            "field": "Z",
            "value": 42
        }
    }
}
"""

Grants

Part of the effort spent in the present code was kindly supported by Fapesp under supervision of Prof. André C. P. L. F. de Carvalho at CEPID-CeMEAI (Grants 2013/07375-0 – 2019/01735-0).

History

The novel ideias presented here are a result of a years-long process of drafts, thinking, trial/error and rewrittings from scratch in several languages from Delphi, passing through Haskell, Java and Scala to Python - including frustration with well stablished libraries at the time. The fundamental concepts were lightly borrowed from basic category theory concepts like algebraic data structures that permeate many recent tendencies, e.g., in programming language design.

For more details, refer to https://github.com/davips/kururu

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

aiuna-0.2102.9.tar.gz (77.4 kB view details)

Uploaded Source

Built Distribution

aiuna-0.2102.9-py3-none-any.whl (104.3 kB view details)

Uploaded Python 3

File details

Details for the file aiuna-0.2102.9.tar.gz.

File metadata

  • Download URL: aiuna-0.2102.9.tar.gz
  • Upload date:
  • Size: 77.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

File hashes

Hashes for aiuna-0.2102.9.tar.gz
Algorithm Hash digest
SHA256 72ed04e9b2d48825803f4e5d7ce5eeb157aad11b06ad0d1cb5dc6c6eca53b089
MD5 ff6f684c854c9f5e296a3b867bd24cbf
BLAKE2b-256 9864c023603bd8a903f943f9907e4db9431f14b3d01a9eac6f8b291d2cb2ce8f

See more details on using hashes here.

File details

Details for the file aiuna-0.2102.9-py3-none-any.whl.

File metadata

  • Download URL: aiuna-0.2102.9-py3-none-any.whl
  • Upload date:
  • Size: 104.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1

File hashes

Hashes for aiuna-0.2102.9-py3-none-any.whl
Algorithm Hash digest
SHA256 889b17aa2c086084a948fad99f0310a4d8fe35ba673013c8341c400ec1bd1f94
MD5 94843d89c6e3c9ff58f3d6f23fa1d0b4
BLAKE2b-256 9c20997d61a3a4315a66c74293273b063769be504453065f334184c726917c75

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