Skip to main content

Primate AI: Tools for decision-making and NLP.

Project description

Primate AI is a Python package that bridges decision-making and natural language processing, inspired by intelligent behavior.

Features

  • Decision-Making Models: - Game-theoretic strategies (e.g., tit-for-tat). - Multi-agent simulations. - Reinforcement learning agents.

  • Natural Language Processing: - Sentiment analysis. - Tokenization, text similarity, and vectorization. - Language evolution simulation.

  • Utility Tools: - Logging and configuration management. - Performance profiling for PyTorch models. - Device helpers for GPU-accelerated computations.

Installation

You can install the package via pip:

pip install primate

Quick Start

Here are a few examples to get started:

### 1. Decision Agent

Simulate decision-making with game-theoretic strategies:

from primate.decision.agent import DecisionAgent

# Create an agent with a strategy
agent = DecisionAgent(strategy="tit_for_tat")
decision = agent.decide(opponent_action="cooperate")
print(f"Agent decided to: {decision}")

### 2. Sentiment Analysis

Analyze the sentiment of text data:

from primate.nlp.sentiment import SentimentAnalyzer

     # Initialize sentiment analyzer
     analyzer = SentimentAnalyzer()
     sentiment = analyzer.analyze("I love bananas!")
     print(f"Sentiment: {sentiment}")  # Output: "positive"

### 3. Tokenization with Transformers

Tokenize text using pre-trained transformer models:

from primate.nlp.tokenizer import Tokenizer

# Initialize tokenizer
tokenizer = Tokenizer(model_name="bert-base-uncased")
tokenized = tokenizer.tokenize(["I love Python!", "NLP is fun."])
print("Input IDs:", tokenized["input_ids"])
print("Attention Masks:", tokenized["attention_mask"])

### 4. Model Profiling

Profile PyTorch models for parameter and operation details:

from primate.utils.helpers import PerformanceHelper
import torch.nn as nn

# Define a simple model
class SimpleModel(nn.Module):
    def __init__(self):
        super(SimpleModel, self).__init__()
        self.linear = nn.Linear(10, 5)

    def forward(self, x):
        return self.linear(x)

model = SimpleModel()
profile = PerformanceHelper.profile_model(model, input_size=(1, 10))
print(profile)

License

This project is licensed under the MIT License.

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

primate-0.2.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

primate-0.2.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file primate-0.2.0.tar.gz.

File metadata

  • Download URL: primate-0.2.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for primate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bdb42c63ce830bf89207a98073de8f29a8baa251f3e5db8aa70931dfa9a2be82
MD5 f3225cfa6a572f147c6711b0881b2c8f
BLAKE2b-256 4c259efeae3a9eac2e4306328816f09e27e69ea71031d42964d211858ed8c021

See more details on using hashes here.

File details

Details for the file primate-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: primate-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for primate-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2901463135186f71619e04e3b712009064e5cedca57cd70d8b0debee62bdfbbe
MD5 e7d86f4e838063d30503e684d286f689
BLAKE2b-256 e26e96bbda765986e1517a285da7d4427044ae53534a28265dd9460ced72ba71

See more details on using hashes here.

Supported by

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