From 3345032a84f14d24cc8eec209bc4b649b8831669 Mon Sep 17 00:00:00 2001 From: Kye Date: Mon, 8 Apr 2024 19:09:55 -0400 Subject: [PATCH] [CLEANUP] --- .readthedocs.yml | 13 -- Dockerfile | 27 ---- Room Management Agent_state.json | 17 --- errors.txt | 0 neo_sapiens/__init__.py | 14 ++ neo_sapiens/problem_solver_pipeline.py | 172 ------------------------- neo_sapiens/test_problem_solver.ipynb | 33 ----- 7 files changed, 14 insertions(+), 262 deletions(-) delete mode 100644 .readthedocs.yml delete mode 100644 Dockerfile delete mode 100644 Room Management Agent_state.json delete mode 100644 errors.txt delete mode 100644 neo_sapiens/problem_solver_pipeline.py delete mode 100644 neo_sapiens/test_problem_solver.ipynb diff --git a/.readthedocs.yml b/.readthedocs.yml deleted file mode 100644 index fbdc74e..0000000 --- a/.readthedocs.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: 2 - -build: - os: ubuntu-22.04 - tools: - python: "3.11" - -mkdocs: - configuration: mkdocs.yml - -python: - install: - - requirements: requirements.txt \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 6eba764..0000000 --- a/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -# ================================== -# Use an official Python runtime as a parent image -FROM python:3.10-slim -RUN apt-get update && apt-get -y install libgl1-mesa-dev libglib2.0-0 build-esse -ntial; apt-get clean -RUN pip install opencv-contrib-python-headless - -# Set environment variables -ENV PYTHONDONTWRITEBYTECODE 1 -ENV PYTHONUNBUFFERED 1 - -# Set the working directory in the container -WORKDIR /usr/src/zeta - - -# Install Python dependencies -# COPY requirements.txt and pyproject.toml if you're using poetry for dependency - management -COPY requirements.txt . -RUN pip install --no-cache-dir --upgrade pip -RUN pip install --no-cache-dir -r requirements.txt - -RUN pip install --no-cache-dir zetascale - -# Copy the rest of the application -COPY . . - diff --git a/Room Management Agent_state.json b/Room Management Agent_state.json deleted file mode 100644 index 2c36475..0000000 --- a/Room Management Agent_state.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "agent_id": "", - "agent_name": "Room Management Agent", - "agent_description": null, - "system_prompt": "Automate room assignments, minibar restocking, and housekeeping schedules", - "sop": null, - "short_memory": "system: Automate room assignments, minibar restocking, and housekeeping schedules\n\n\nHuman:: What is your name\n\n\nRoom Management Agent: content='I am a system designed to automate room assignments, minibar restocking, and housekeeping schedules.' response_metadata={'token_usage': {'completion_tokens': 20, 'prompt_tokens': 31, 'total_tokens': 51}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': 'fp_b28b39ffa8', 'finish_reason': 'stop', 'logprobs': None}\n\n\nHuman:: \u001b[31m/usr/local/bin/python3 /Users/defalt/Desktop/Athena/research/NeoSapiens/neo_sapiens/hass_schema.py\u001b[0m\n\n", - "loop_interval": 0, - "retry_attempts": 3, - "retry_interval": 1, - "interactive": true, - "dashboard": false, - "dynamic_temperature": false, - "autosave": true, - "saved_state_path": "Room Management Agent_state.json", - "max_loops": 1 -} \ No newline at end of file diff --git a/errors.txt b/errors.txt deleted file mode 100644 index e69de29..0000000 diff --git a/neo_sapiens/__init__.py b/neo_sapiens/__init__.py index e69de29..2cf2295 100644 --- a/neo_sapiens/__init__.py +++ b/neo_sapiens/__init__.py @@ -0,0 +1,14 @@ +from neo_sapiens.few_shot_prompts import data, data1, data2, data3, data5 +from neo_sapiens.hass_schema import parse_hass_schema, merge_plans_into_str, merge_rules_into_str + + +__all__ = [ + "data", + "data1", + "data2", + "data3", + "data5", + "parse_hass_schema", + "merge_plans_into_str", + "merge_rules_into_str", +] \ No newline at end of file diff --git a/neo_sapiens/problem_solver_pipeline.py b/neo_sapiens/problem_solver_pipeline.py deleted file mode 100644 index a310117..0000000 --- a/neo_sapiens/problem_solver_pipeline.py +++ /dev/null @@ -1,172 +0,0 @@ -# Filename: dynamic_pipeline_with_nn.py - -from sklearn.ensemble import ( - RandomForestClassifier, - RandomForestRegressor, -) -from sklearn.linear_model import LogisticRegression, Ridge -from sklearn.metrics import accuracy_score, r2_score -from sklearn.model_selection import train_test_split -from sklearn.datasets import make_classification -from tensorflow.keras.models import Sequential -from tensorflow.keras.layers import Dense -from tensorflow.keras.optimizers import Adam -import numpy as np - - -def analyze_problem_statement(problem_statement): - """ - Analyze the problem statement to determine the type of problem. - """ - if ( - "classify" in problem_statement - or "classification" in problem_statement - ): - return "classification" - elif ( - "predict" in problem_statement - or "regression" in problem_statement - ): - return "regression" - else: - return "unknown" - - -def generate_solving_function(problem_type, dataset=None): - """ - Dynamically generate a function that tries multiple models and selects the best one. - """ - if problem_type == "classification": - models = { - "RandomForestClassifier": RandomForestClassifier(), - "LogisticRegression": LogisticRegression(), - "NeuralNetwork": ( # Placeholder for NN model - "NN_Classification" - ), - } - elif problem_type == "regression": - models = { - "RandomForestRegressor": RandomForestRegressor(), - "RidgeRegression": Ridge(), - "NeuralNetwork": ( # Placeholder for NN model - "NN_Regression" - ), - } - else: - print("Unknown problem type.") - return None - - def solve_with_nn(X_train, X_test, y_train, y_test, problem_type): - """ - Trains and evaluates a simple neural network. - """ - model = Sequential( - [ - Dense( - 128, - activation="relu", - input_shape=(X_train.shape[1],), - ), - Dense(64, activation="relu"), - Dense( - 1, - activation=( - "sigmoid" - if problem_type == "classification" - else "linear" - ), - ), - ] - ) - model.compile( - optimizer=Adam(), - loss=( - "binary_crossentropy" - if problem_type == "classification" - else "mean_squared_error" - ), - metrics=( - ["accuracy"] - if problem_type == "classification" - else ["mse"] - ), - ) - model.fit( - X_train, y_train, epochs=100, batch_size=10, verbose=0 - ) - eval_result = model.evaluate(X_test, y_test, verbose=0) - return model, eval_result[1] - - def solving_function(X, y): - """ - Function to try multiple models and select the one with the best performance. - """ - X_train, X_test, y_train, y_test = train_test_split( - X, y, test_size=0.2, random_state=42 - ) - best_score = -np.inf - best_model = None - best_model_name = "" - - for name, model in models.items(): - if "NeuralNetwork" in name: - model, score = solve_with_nn( - X_train, X_test, y_train, y_test, problem_type - ) - else: - model.fit(X_train, y_train) - predictions = model.predict(X_test) - score = ( - accuracy_score(y_test, predictions) - if problem_type == "classification" - else r2_score(y_test, predictions) - ) - print(f"{name} Performance: {score}") - - if score > best_score: - best_score = score - best_model = model - best_model_name = name - - print( - f"Best Model: {best_model_name} with a score of" - f" {best_score}" - ) - return best_model - - return solving_function - - -def pipeline(dataset=None): - """ - The main pipeline prompts for a problem statement and uses an optional dataset to dynamically create and apply a solving function. - """ - problem_statement = input("Enter your problem statement: ") - problem_type = analyze_problem_statement(problem_statement) - solving_function = generate_solving_function( - problem_type, dataset - ) - - if solving_function and dataset is not None: - X, y = dataset - solving_function(X, y) - else: - print( - "No dataset provided or unknown problem type. Function" - " generation might be limited." - ) - - -# Example usage -if __name__ == "__main__": - # Example dataset for demonstration; replace with actual data as needed. - X, y = make_classification( - n_samples=100, - n_features=4, - n_informative=2, - n_redundant=0, - random_state=42, - ) - dataset = (X, y) - - pipeline(dataset) diff --git a/neo_sapiens/test_problem_solver.ipynb b/neo_sapiens/test_problem_solver.ipynb deleted file mode 100644 index 6707676..0000000 --- a/neo_sapiens/test_problem_solver.ipynb +++ /dev/null @@ -1,33 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "89bb59cb", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.8" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}