Remove web/ prototype; update docs to reflect app integration
The web/ directory (bicorder-classifier.js, .d.ts, test-classifier.mjs) was a prototype superseded by bicorder-app/src/bicorder-classifier.ts. The only integration point between this analysis directory and the app is bicorder_model.json, which Vite reads at build time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,30 +19,18 @@ This ensures the web app and model stay in sync without complex backward compati
|
||||
|
||||
## Files
|
||||
|
||||
- `bicorder_model.json` - Trained model parameters (5KB, embed in app)
|
||||
- `web/bicorder-classifier.js` - JavaScript implementation
|
||||
- `web/bicorder-classifier.d.ts` - TypeScript type definitions
|
||||
- `bicorder_model.json` - Trained model parameters (~5KB); read by `bicorder-app` at build time from `../analysis/bicorder_model.json`
|
||||
- `bicorder-app/src/bicorder-classifier.ts` - TypeScript classifier implementation (lives in the app, not here)
|
||||
|
||||
The model is the only artifact produced by this analysis directory that the app consumes. Regenerate it after re-running analysis on the synthetic dataset:
|
||||
|
||||
```bash
|
||||
python3 scripts/export_model_for_js.py data/readings/synthetic_20251116/readings.csv
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Copy Model File
|
||||
|
||||
Copy `bicorder_model.json` to your web app's public/static assets:
|
||||
|
||||
```bash
|
||||
cp bicorder_model.json ../path/to/bicorder/public/
|
||||
```
|
||||
|
||||
### 2. Install Classifier
|
||||
|
||||
Copy the JavaScript module to your source directory:
|
||||
|
||||
```bash
|
||||
cp web/bicorder-classifier.js ../path/to/bicorder/src/lib/
|
||||
cp web/bicorder-classifier.d.ts ../path/to/bicorder/src/lib/
|
||||
```
|
||||
|
||||
### 3. Basic Usage
|
||||
### Basic Usage
|
||||
|
||||
```javascript
|
||||
import { loadClassifier } from './lib/bicorder-classifier.js';
|
||||
@@ -343,11 +331,11 @@ Check if enough key dimensions are provided.
|
||||
|
||||
## Testing
|
||||
|
||||
Test the classifier with example protocols:
|
||||
Test the classifier with example protocols (run from within `bicorder-app`):
|
||||
|
||||
```javascript
|
||||
import { BicorderClassifier } from './bicorder-classifier.js';
|
||||
import modelData from './bicorder_model.json';
|
||||
import { BicorderClassifier } from './bicorder-classifier';
|
||||
import modelData from '../../analysis/bicorder_model.json';
|
||||
|
||||
const classifier = new BicorderClassifier(modelData);
|
||||
|
||||
@@ -395,8 +383,4 @@ console.log(classifier.predict(boundary));
|
||||
|
||||
## Questions?
|
||||
|
||||
See the test in `web/test-classifier.mjs` for working examples, or test with:
|
||||
|
||||
```bash
|
||||
node web/test-classifier.mjs
|
||||
```
|
||||
See `bicorder-app/src/bicorder-classifier.ts` for the live implementation, and `bicorder-app/src/App.svelte` for how it's wired into the form.
|
||||
|
||||
Reference in New Issue
Block a user