Tuesday, February 17, 2026

#Claude #AI has Built a Perfomalist #ChangePoint Client - README and validation

Below is readme file generated by Claude code for the task  "How #Claude #AI Built a Perfomalist #ChangePoint Client" from the previous post and quick graphical validation.

___________________________________ 

# Perfomalist API Change Point Detection

Programs to call the Perfomalist Control Points API and identify the 3 most significant change points in time-stamped data.

## Available Versions

- **Python**: `perfomalist_changepoints.py`
- **R**: `perfomalist_changepoints.R`

## API Overview

The Perfomalist API analyzes time series data for control points (change points) using statistical methods.

**Endpoint**: `POST https://api.perfomalist.com/api/controlpoints.py`

## Installation

### Python Requirements

```bash
pip install requests
```

### R Requirements

```r
install.packages(c("httr", "readr"))
```

## Usage

### Python

#### Quick Start (with sample data)

```bash
python perfomalist_changepoints.py
```

#### Using Your Own Data

1. **Modify the script** to load your CSV file:

```python
# In the main() function, replace:
data = create_sample_data()

# With:
data = load_data_from_csv('your_data.csv')
```

2. **CSV Format**: Your file should have these columns:
   - `Date` (e.g., "7/2/2011")
   - `Hour` (e.g., "0", "1", "2", ...)
   - `Value` (numeric)

3. **Adjust parameters** (optional):

```python
api_client = PerfomalistAPI(
    s_value=99,          # Statistical band (0-100)
    e_value=5,           # Exception threshold (%)
    baseline_length=7    # Baseline period (days)
)
```

### R

#### Quick Start (with sample data)

```bash
Rscript perfomalist_changepoints.R
```

#### Using Your Own Data

1. **Modify the script** to load your CSV file:

```r
# In the main() function, replace:
data <- create_sample_data()

# With:
data <- load_data_from_csv("your_data.csv")
```

2. **Adjust parameters** (optional):

```r
config <- list(
  s_value = 99,           # Statistical band (0-100)
  e_value = 5,            # Exception threshold (%)
  baseline_length = 7     # Baseline period (days)
)
```

## API Parameters

### sValue (Statistical Band)
- Range: 0-100
- 100 = UCL (Upper Control Limit) = MAX
- 0 = UCL = LCL = mean
- Default: 99
- Higher values create wider control bands

### eValue (Exception Value)
- Exception threshold as % of historical average
- Default: 5
- Determines sensitivity to deviations

### BaseLineLength
- Number of time periods to compare against
- Default: 7
- Acts as the baseline/comparison window

## Input Data Format

Your CSV should follow this structure:

```csv
Date,Hour,Value
7/2/2011,0,236274
7/2/2011,1,215359
7/2/2011,2,170011
7/2/2011,3,142371
...
```

## Output

The programs will:

1. **Display the raw API response** - so you can see all data returned
2. **Parse the response** - extract change points from the API output
3. **Rank by significance** - identify the most important change points
4. **Show top 3 change points** - with all relevant metrics

### Example Output

```
======================================================================
Perfomalist API - Change Point Detection
======================================================================

Using sample data...
Loaded 24 data points

Calling Perfomalist API...

API Response received
----------------------------------------------------------------------
[API response displayed here]
----------------------------------------------------------------------

Found 15 total data points in response

======================================================================
TOP 3 MOST SIGNIFICANT CHANGE POINTS:
======================================================================

#1 Change Point:
  Date: 7/2/2011
  Hour: 13
  Value: 285471
  Signal: 2.45
  Deviation: 3.2

#2 Change Point:
  Date: 7/2/2011
  Hour: 5
  Value: 126836
  Signal: -2.1
  Deviation: 2.8

#3 Change Point:
  Date: 7/2/2011
  Hour: 22
  Value: 255439
  Signal: 1.8
  Deviation: 2.3
```

## Programmatic Usage

### Python - As a Module

```python
from perfomalist_changepoints import PerfomalistAPI, load_data_from_csv

# Load your data
data = load_data_from_csv('mydata.csv')

# Initialize client
api = PerfomalistAPI(s_value=99, e_value=5, baseline_length=7)

# Prepare input
csv_input = api.prepare_csv_input(data)

# Call API
response = api.call_api(csv_input)

# Parse results
change_points = api.parse_response(response)

# Get top 3
top_3 = api.find_top_changepoints(change_points, top_n=3)

for cp in top_3:
    print(cp)
```

### R - Source as Library

```r
source("perfomalist_changepoints.R")

# Load your data
data <- load_data_from_csv("mydata.csv")

# Call API
response_text <- call_perfomalist_api(
  data,
  s_value = 99,
  e_value = 5,
  baseline_length = 7
)

# Parse and find top change points
response_df <- parse_response(response_text)
top_3 <- find_top_changepoints(response_df, top_n = 3)

print(top_3)
```

## Troubleshooting

### API Returns Error
- Check your internet connection
- Verify the API endpoint is accessible: www.perfomalist.com
- Ensure your data format matches the expected CSV structure

### No Change Points Found
- Try adjusting the `eValue` parameter (lower = more sensitive)
- Check if your data has enough variation
- Verify the `baseline_length` is appropriate for your data frequency

### Parsing Issues
- The script will display the raw API response for manual inspection
- Check that column names in the response match expected patterns
- You may need to customize the parsing logic based on the actual API response format

## API Response Format Note

The actual response format from the Perfomalist API may vary. The programs include flexible parsing logic to handle common formats, but you may need to inspect the raw response and adjust the parsing if the format differs from expectations.

## More Information

- Website: www.perfomalist.com
- Download sample data and documentation from the website

## License

These scripts are provided as-is for use with the Perfomalist API service.
 

_______________

Below is the quick graphical validation showing where the 3 change points were found:


 

No comments:

Post a Comment

#Claude #AI has Built a Perfomalist #ChangePoint Client - README and validation

Below is readme file generated by Claude code for the task  " How #Claude #AI Built a Perfomalist #ChangePoint Client " from the p...