Deploy qmd-web
Browse files- .gitignore +0 -26
- deploy.sh +0 -49
- eslint.config.js +0 -23
- {public/eval-docs → eval-docs}/history-of-coffee.md +0 -0
- index.html +1 -1
- package-lock.json +0 -0
- package.json +0 -33
- public/eval-docs/api-design-principles.md +0 -73
- public/eval-docs/distributed-systems-overview.md +0 -92
- public/eval-docs/machine-learning-primer.md +0 -125
- tsconfig.app.json +0 -28
- tsconfig.json +0 -7
- tsconfig.node.json +0 -26
- vite.config.ts +0 -15
.gitignore
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
# Logs
|
| 2 |
-
logs
|
| 3 |
-
*.log
|
| 4 |
-
npm-debug.log*
|
| 5 |
-
yarn-debug.log*
|
| 6 |
-
yarn-error.log*
|
| 7 |
-
pnpm-debug.log*
|
| 8 |
-
lerna-debug.log*
|
| 9 |
-
|
| 10 |
-
node_modules
|
| 11 |
-
dist
|
| 12 |
-
dist-ssr
|
| 13 |
-
*.local
|
| 14 |
-
|
| 15 |
-
# Editor directories and files
|
| 16 |
-
.vscode/*
|
| 17 |
-
!.vscode/extensions.json
|
| 18 |
-
.idea
|
| 19 |
-
.DS_Store
|
| 20 |
-
*.suo
|
| 21 |
-
*.ntvs*
|
| 22 |
-
*.njsproj
|
| 23 |
-
*.sln
|
| 24 |
-
*.sw?
|
| 25 |
-
assets/
|
| 26 |
-
dist/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deploy.sh
DELETED
|
@@ -1,49 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
# Deploy qmd-web to HuggingFace Space
|
| 3 |
-
# Uploads dist/ + eval-docs/ + src/ via HF API (no git LFS needed)
|
| 4 |
-
|
| 5 |
-
set -e
|
| 6 |
-
|
| 7 |
-
SPACE_ID="shreyask/qmd-web"
|
| 8 |
-
|
| 9 |
-
echo "Building..."
|
| 10 |
-
npm run build
|
| 11 |
-
|
| 12 |
-
echo "Deploying to $SPACE_ID..."
|
| 13 |
-
python3 -c "
|
| 14 |
-
from huggingface_hub import HfApi
|
| 15 |
-
import shutil, os
|
| 16 |
-
from pathlib import Path
|
| 17 |
-
|
| 18 |
-
SPACE_ID = '$SPACE_ID'
|
| 19 |
-
PROJECT = '$(pwd)'
|
| 20 |
-
STAGE = '/tmp/qmd-web-deploy'
|
| 21 |
-
|
| 22 |
-
if os.path.exists(STAGE):
|
| 23 |
-
shutil.rmtree(STAGE)
|
| 24 |
-
os.makedirs(STAGE)
|
| 25 |
-
|
| 26 |
-
# dist/ contents -> root (includes index.html, assets/, eval-docs/ from public/)
|
| 27 |
-
for item in Path(f'{PROJECT}/dist').iterdir():
|
| 28 |
-
dest = Path(STAGE) / item.name
|
| 29 |
-
if item.is_dir():
|
| 30 |
-
shutil.copytree(item, dest)
|
| 31 |
-
else:
|
| 32 |
-
shutil.copy2(item, dest)
|
| 33 |
-
|
| 34 |
-
# src/ for reference
|
| 35 |
-
shutil.copytree(f'{PROJECT}/src', f'{STAGE}/src')
|
| 36 |
-
|
| 37 |
-
# README with HF Space metadata
|
| 38 |
-
shutil.copy2(f'{PROJECT}/README.md', f'{STAGE}/README.md')
|
| 39 |
-
|
| 40 |
-
api = HfApi()
|
| 41 |
-
api.upload_folder(
|
| 42 |
-
folder_path=STAGE,
|
| 43 |
-
repo_id=SPACE_ID,
|
| 44 |
-
repo_type='space',
|
| 45 |
-
delete_patterns=['*'],
|
| 46 |
-
commit_message='Deploy qmd-web',
|
| 47 |
-
)
|
| 48 |
-
print(f'Deployed! https://huggingface.co/spaces/{SPACE_ID}')
|
| 49 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eslint.config.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
| 1 |
-
import js from '@eslint/js'
|
| 2 |
-
import globals from 'globals'
|
| 3 |
-
import reactHooks from 'eslint-plugin-react-hooks'
|
| 4 |
-
import reactRefresh from 'eslint-plugin-react-refresh'
|
| 5 |
-
import tseslint from 'typescript-eslint'
|
| 6 |
-
import { defineConfig, globalIgnores } from 'eslint/config'
|
| 7 |
-
|
| 8 |
-
export default defineConfig([
|
| 9 |
-
globalIgnores(['dist']),
|
| 10 |
-
{
|
| 11 |
-
files: ['**/*.{ts,tsx}'],
|
| 12 |
-
extends: [
|
| 13 |
-
js.configs.recommended,
|
| 14 |
-
tseslint.configs.recommended,
|
| 15 |
-
reactHooks.configs.flat.recommended,
|
| 16 |
-
reactRefresh.configs.vite,
|
| 17 |
-
],
|
| 18 |
-
languageOptions: {
|
| 19 |
-
ecmaVersion: 2020,
|
| 20 |
-
globals: globals.browser,
|
| 21 |
-
},
|
| 22 |
-
},
|
| 23 |
-
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{public/eval-docs → eval-docs}/history-of-coffee.md
RENAMED
|
File without changes
|
index.html
CHANGED
|
@@ -81,9 +81,9 @@
|
|
| 81 |
}
|
| 82 |
})();
|
| 83 |
</script>
|
|
|
|
| 84 |
</head>
|
| 85 |
<body>
|
| 86 |
<div id="root"></div>
|
| 87 |
-
<script type="module" src="/src/main.tsx"></script>
|
| 88 |
</body>
|
| 89 |
</html>
|
|
|
|
| 81 |
}
|
| 82 |
})();
|
| 83 |
</script>
|
| 84 |
+
<script type="module" crossorigin src="./assets/index-CkVH_59C.js"></script>
|
| 85 |
</head>
|
| 86 |
<body>
|
| 87 |
<div id="root"></div>
|
|
|
|
| 88 |
</body>
|
| 89 |
</html>
|
package-lock.json
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
package.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"name": "qmd-web",
|
| 3 |
-
"private": true,
|
| 4 |
-
"version": "0.0.0",
|
| 5 |
-
"type": "module",
|
| 6 |
-
"scripts": {
|
| 7 |
-
"dev": "vite",
|
| 8 |
-
"build": "tsc -b && vite build",
|
| 9 |
-
"lint": "eslint .",
|
| 10 |
-
"preview": "vite preview"
|
| 11 |
-
},
|
| 12 |
-
"dependencies": {
|
| 13 |
-
"@huggingface/transformers": "^4.0.0-next.7",
|
| 14 |
-
"react": "^19.2.0",
|
| 15 |
-
"react-dom": "^19.2.0"
|
| 16 |
-
},
|
| 17 |
-
"devDependencies": {
|
| 18 |
-
"@eslint/js": "^9.39.1",
|
| 19 |
-
"@types/node": "^24.10.1",
|
| 20 |
-
"@types/react": "^19.2.7",
|
| 21 |
-
"@types/react-dom": "^19.2.3",
|
| 22 |
-
"@vitejs/plugin-react": "^5.1.1",
|
| 23 |
-
"@webgpu/types": "^0.1.69",
|
| 24 |
-
"eslint": "^9.39.1",
|
| 25 |
-
"eslint-plugin-react-hooks": "^7.0.1",
|
| 26 |
-
"eslint-plugin-react-refresh": "^0.4.24",
|
| 27 |
-
"globals": "^16.5.0",
|
| 28 |
-
"typescript": "~5.9.3",
|
| 29 |
-
"typescript-eslint": "^8.48.0",
|
| 30 |
-
"vite": "^7.3.1",
|
| 31 |
-
"vitest": "^4.0.18"
|
| 32 |
-
}
|
| 33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public/eval-docs/api-design-principles.md
DELETED
|
@@ -1,73 +0,0 @@
|
|
| 1 |
-
# API Design Principles
|
| 2 |
-
|
| 3 |
-
## Introduction
|
| 4 |
-
|
| 5 |
-
Good API design is crucial for developer experience. This document outlines the core principles we follow when designing REST APIs.
|
| 6 |
-
|
| 7 |
-
## Principle 1: Use Nouns, Not Verbs
|
| 8 |
-
|
| 9 |
-
URLs should represent resources, not actions. Use HTTP methods to indicate the action.
|
| 10 |
-
|
| 11 |
-
**Good:**
|
| 12 |
-
- GET /users/123
|
| 13 |
-
- POST /orders
|
| 14 |
-
- DELETE /products/456
|
| 15 |
-
|
| 16 |
-
**Bad:**
|
| 17 |
-
- GET /getUser?id=123
|
| 18 |
-
- POST /createOrder
|
| 19 |
-
- GET /deleteProduct/456
|
| 20 |
-
|
| 21 |
-
## Principle 2: Use Plural Nouns
|
| 22 |
-
|
| 23 |
-
Always use plural nouns for consistency.
|
| 24 |
-
|
| 25 |
-
- /users (not /user)
|
| 26 |
-
- /orders (not /order)
|
| 27 |
-
- /products (not /product)
|
| 28 |
-
|
| 29 |
-
## Principle 3: Hierarchical Relationships
|
| 30 |
-
|
| 31 |
-
Express relationships through URL hierarchy.
|
| 32 |
-
|
| 33 |
-
- GET /users/123/orders - Get all orders for user 123
|
| 34 |
-
- GET /users/123/orders/456 - Get specific order 456 for user 123
|
| 35 |
-
|
| 36 |
-
## Principle 4: Filtering and Pagination
|
| 37 |
-
|
| 38 |
-
Use query parameters for filtering, sorting, and pagination.
|
| 39 |
-
|
| 40 |
-
- GET /products?category=electronics&sort=price&page=2&limit=20
|
| 41 |
-
|
| 42 |
-
## Principle 5: Versioning
|
| 43 |
-
|
| 44 |
-
Always version your APIs. We prefer URL versioning.
|
| 45 |
-
|
| 46 |
-
- /v1/users
|
| 47 |
-
- /v2/users
|
| 48 |
-
|
| 49 |
-
## Principle 6: Error Handling
|
| 50 |
-
|
| 51 |
-
Return consistent error responses with appropriate HTTP status codes.
|
| 52 |
-
|
| 53 |
-
```json
|
| 54 |
-
{
|
| 55 |
-
"error": {
|
| 56 |
-
"code": "VALIDATION_ERROR",
|
| 57 |
-
"message": "Email format is invalid",
|
| 58 |
-
"field": "email"
|
| 59 |
-
}
|
| 60 |
-
}
|
| 61 |
-
```
|
| 62 |
-
|
| 63 |
-
## Principle 7: Rate Limiting
|
| 64 |
-
|
| 65 |
-
Implement rate limiting and communicate limits via headers:
|
| 66 |
-
|
| 67 |
-
- X-RateLimit-Limit: 1000
|
| 68 |
-
- X-RateLimit-Remaining: 999
|
| 69 |
-
- X-RateLimit-Reset: 1640000000
|
| 70 |
-
|
| 71 |
-
## Conclusion
|
| 72 |
-
|
| 73 |
-
Following these principles leads to APIs that are intuitive, consistent, and easy to maintain. Remember: the best API is one that developers can use without reading documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public/eval-docs/distributed-systems-overview.md
DELETED
|
@@ -1,92 +0,0 @@
|
|
| 1 |
-
# Distributed Systems: A Practical Overview
|
| 2 |
-
|
| 3 |
-
## What Makes a System "Distributed"?
|
| 4 |
-
|
| 5 |
-
A distributed system is a collection of independent computers that appears to users as a single coherent system. The key challenges arise from:
|
| 6 |
-
|
| 7 |
-
1. **Partial failure** - Parts of the system can fail independently
|
| 8 |
-
2. **Unreliable networks** - Messages can be lost, delayed, or duplicated
|
| 9 |
-
3. **No global clock** - Different nodes have different views of time
|
| 10 |
-
|
| 11 |
-
## The CAP Theorem
|
| 12 |
-
|
| 13 |
-
Eric Brewer's CAP theorem states that a distributed system can only provide two of three guarantees:
|
| 14 |
-
|
| 15 |
-
- **Consistency**: All nodes see the same data at the same time
|
| 16 |
-
- **Availability**: Every request receives a response
|
| 17 |
-
- **Partition tolerance**: System continues operating despite network partitions
|
| 18 |
-
|
| 19 |
-
In practice, network partitions happen, so you're really choosing between CP and AP systems.
|
| 20 |
-
|
| 21 |
-
### CP Systems (Consistency + Partition Tolerance)
|
| 22 |
-
- Examples: ZooKeeper, etcd, Consul
|
| 23 |
-
- Sacrifice availability during partitions
|
| 24 |
-
- Good for: coordination, leader election, configuration
|
| 25 |
-
|
| 26 |
-
### AP Systems (Availability + Partition Tolerance)
|
| 27 |
-
- Examples: Cassandra, DynamoDB, CouchDB
|
| 28 |
-
- Sacrifice consistency during partitions
|
| 29 |
-
- Good for: high-throughput, always-on services
|
| 30 |
-
|
| 31 |
-
## Consensus Algorithms
|
| 32 |
-
|
| 33 |
-
When nodes need to agree on something, they use consensus algorithms.
|
| 34 |
-
|
| 35 |
-
### Paxos
|
| 36 |
-
- Original consensus algorithm by Leslie Lamport
|
| 37 |
-
- Notoriously difficult to understand and implement
|
| 38 |
-
- Foundation for many other algorithms
|
| 39 |
-
|
| 40 |
-
### Raft
|
| 41 |
-
- Designed to be understandable
|
| 42 |
-
- Used in etcd, Consul, CockroachDB
|
| 43 |
-
- Separates leader election from log replication
|
| 44 |
-
|
| 45 |
-
### PBFT (Practical Byzantine Fault Tolerance)
|
| 46 |
-
- Handles malicious nodes
|
| 47 |
-
- Used in blockchain systems
|
| 48 |
-
- Higher overhead than crash-fault-tolerant algorithms
|
| 49 |
-
|
| 50 |
-
## Replication Strategies
|
| 51 |
-
|
| 52 |
-
### Single-Leader Replication
|
| 53 |
-
- One node accepts writes
|
| 54 |
-
- Followers replicate from leader
|
| 55 |
-
- Simple but leader is bottleneck
|
| 56 |
-
|
| 57 |
-
### Multi-Leader Replication
|
| 58 |
-
- Multiple nodes accept writes
|
| 59 |
-
- Must handle write conflicts
|
| 60 |
-
- Good for multi-datacenter deployments
|
| 61 |
-
|
| 62 |
-
### Leaderless Replication
|
| 63 |
-
- Any node accepts writes
|
| 64 |
-
- Uses quorum reads/writes
|
| 65 |
-
- Examples: Dynamo-style databases
|
| 66 |
-
|
| 67 |
-
## Consistency Models
|
| 68 |
-
|
| 69 |
-
From strongest to weakest:
|
| 70 |
-
|
| 71 |
-
1. **Linearizability** - Operations appear instantaneous
|
| 72 |
-
2. **Sequential consistency** - Operations appear in some sequential order
|
| 73 |
-
3. **Causal consistency** - Causally related operations appear in order
|
| 74 |
-
4. **Eventual consistency** - Given enough time, all replicas converge
|
| 75 |
-
|
| 76 |
-
## Partitioning (Sharding)
|
| 77 |
-
|
| 78 |
-
Distributing data across nodes:
|
| 79 |
-
|
| 80 |
-
### Hash Partitioning
|
| 81 |
-
- Hash key to determine partition
|
| 82 |
-
- Even distribution
|
| 83 |
-
- Range queries are inefficient
|
| 84 |
-
|
| 85 |
-
### Range Partitioning
|
| 86 |
-
- Ranges of keys on different nodes
|
| 87 |
-
- Good for range queries
|
| 88 |
-
- Risk of hot spots
|
| 89 |
-
|
| 90 |
-
## Conclusion
|
| 91 |
-
|
| 92 |
-
Building distributed systems requires understanding these fundamental concepts. Start simple, add complexity only when needed, and always plan for failure.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public/eval-docs/machine-learning-primer.md
DELETED
|
@@ -1,125 +0,0 @@
|
|
| 1 |
-
# Machine Learning: A Beginner's Guide
|
| 2 |
-
|
| 3 |
-
## What is Machine Learning?
|
| 4 |
-
|
| 5 |
-
Machine learning is a subset of artificial intelligence where systems learn patterns from data rather than being explicitly programmed. Instead of writing rules, you provide examples and let the algorithm discover the rules.
|
| 6 |
-
|
| 7 |
-
## Types of Machine Learning
|
| 8 |
-
|
| 9 |
-
### Supervised Learning
|
| 10 |
-
|
| 11 |
-
The algorithm learns from labeled examples.
|
| 12 |
-
|
| 13 |
-
**Classification**: Predicting categories
|
| 14 |
-
- Email spam detection
|
| 15 |
-
- Image recognition
|
| 16 |
-
- Medical diagnosis
|
| 17 |
-
|
| 18 |
-
**Regression**: Predicting continuous values
|
| 19 |
-
- House price prediction
|
| 20 |
-
- Stock price forecasting
|
| 21 |
-
- Temperature prediction
|
| 22 |
-
|
| 23 |
-
Common algorithms:
|
| 24 |
-
- Linear Regression
|
| 25 |
-
- Logistic Regression
|
| 26 |
-
- Decision Trees
|
| 27 |
-
- Random Forests
|
| 28 |
-
- Support Vector Machines (SVM)
|
| 29 |
-
- Neural Networks
|
| 30 |
-
|
| 31 |
-
### Unsupervised Learning
|
| 32 |
-
|
| 33 |
-
The algorithm finds patterns in unlabeled data.
|
| 34 |
-
|
| 35 |
-
**Clustering**: Grouping similar items
|
| 36 |
-
- Customer segmentation
|
| 37 |
-
- Document categorization
|
| 38 |
-
- Anomaly detection
|
| 39 |
-
|
| 40 |
-
**Dimensionality Reduction**: Simplifying data
|
| 41 |
-
- Feature extraction
|
| 42 |
-
- Visualization
|
| 43 |
-
- Noise reduction
|
| 44 |
-
|
| 45 |
-
Common algorithms:
|
| 46 |
-
- K-Means Clustering
|
| 47 |
-
- Hierarchical Clustering
|
| 48 |
-
- Principal Component Analysis (PCA)
|
| 49 |
-
- t-SNE
|
| 50 |
-
|
| 51 |
-
### Reinforcement Learning
|
| 52 |
-
|
| 53 |
-
The algorithm learns through trial and error, receiving rewards or penalties.
|
| 54 |
-
|
| 55 |
-
Applications:
|
| 56 |
-
- Game playing (AlphaGo, chess)
|
| 57 |
-
- Robotics
|
| 58 |
-
- Autonomous vehicles
|
| 59 |
-
- Resource management
|
| 60 |
-
|
| 61 |
-
## The Machine Learning Pipeline
|
| 62 |
-
|
| 63 |
-
1. **Data Collection**: Gather relevant data
|
| 64 |
-
2. **Data Cleaning**: Handle missing values, outliers
|
| 65 |
-
3. **Feature Engineering**: Create useful features
|
| 66 |
-
4. **Model Selection**: Choose appropriate algorithm
|
| 67 |
-
5. **Training**: Fit model to training data
|
| 68 |
-
6. **Evaluation**: Test on held-out data
|
| 69 |
-
7. **Deployment**: Put model into production
|
| 70 |
-
8. **Monitoring**: Track performance over time
|
| 71 |
-
|
| 72 |
-
## Key Concepts
|
| 73 |
-
|
| 74 |
-
### Overfitting vs Underfitting
|
| 75 |
-
|
| 76 |
-
**Overfitting**: Model memorizes training data, performs poorly on new data
|
| 77 |
-
- Solution: More data, regularization, simpler model
|
| 78 |
-
|
| 79 |
-
**Underfitting**: Model too simple to capture patterns
|
| 80 |
-
- Solution: More features, complex model, less regularization
|
| 81 |
-
|
| 82 |
-
### Train/Test Split
|
| 83 |
-
|
| 84 |
-
Never evaluate on training data. Common splits:
|
| 85 |
-
- 80% training, 20% testing
|
| 86 |
-
- 70% training, 15% validation, 15% testing
|
| 87 |
-
|
| 88 |
-
### Cross-Validation
|
| 89 |
-
|
| 90 |
-
K-fold cross-validation provides more robust evaluation:
|
| 91 |
-
1. Split data into K folds
|
| 92 |
-
2. Train on K-1 folds, test on remaining fold
|
| 93 |
-
3. Repeat K times
|
| 94 |
-
4. Average the results
|
| 95 |
-
|
| 96 |
-
### Bias-Variance Tradeoff
|
| 97 |
-
|
| 98 |
-
- **High Bias**: Oversimplified model (underfitting)
|
| 99 |
-
- **High Variance**: Overcomplicated model (overfitting)
|
| 100 |
-
- Goal: Find the sweet spot
|
| 101 |
-
|
| 102 |
-
## Evaluation Metrics
|
| 103 |
-
|
| 104 |
-
### Classification
|
| 105 |
-
- Accuracy: Correct predictions / Total predictions
|
| 106 |
-
- Precision: True positives / Predicted positives
|
| 107 |
-
- Recall: True positives / Actual positives
|
| 108 |
-
- F1 Score: Harmonic mean of precision and recall
|
| 109 |
-
- AUC-ROC: Area under receiver operating curve
|
| 110 |
-
|
| 111 |
-
### Regression
|
| 112 |
-
- Mean Absolute Error (MAE)
|
| 113 |
-
- Mean Squared Error (MSE)
|
| 114 |
-
- Root Mean Squared Error (RMSE)
|
| 115 |
-
- R-squared (R2)
|
| 116 |
-
|
| 117 |
-
## Getting Started
|
| 118 |
-
|
| 119 |
-
1. Learn Python and libraries (NumPy, Pandas, Scikit-learn)
|
| 120 |
-
2. Work through classic datasets (Iris, MNIST, Titanic)
|
| 121 |
-
3. Take online courses (Coursera, fast.ai)
|
| 122 |
-
4. Practice on Kaggle competitions
|
| 123 |
-
5. Build projects with real-world data
|
| 124 |
-
|
| 125 |
-
Remember: Machine learning is 80% data preparation and 20% modeling. Start with clean data and simple models before going complex.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tsconfig.app.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"compilerOptions": {
|
| 3 |
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
| 4 |
-
"target": "ES2022",
|
| 5 |
-
"useDefineForClassFields": true,
|
| 6 |
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
| 7 |
-
"module": "ESNext",
|
| 8 |
-
"types": ["vite/client", "@webgpu/types"],
|
| 9 |
-
"skipLibCheck": true,
|
| 10 |
-
|
| 11 |
-
/* Bundler mode */
|
| 12 |
-
"moduleResolution": "bundler",
|
| 13 |
-
"allowImportingTsExtensions": true,
|
| 14 |
-
"verbatimModuleSyntax": true,
|
| 15 |
-
"moduleDetection": "force",
|
| 16 |
-
"noEmit": true,
|
| 17 |
-
"jsx": "react-jsx",
|
| 18 |
-
|
| 19 |
-
/* Linting */
|
| 20 |
-
"strict": true,
|
| 21 |
-
"noUnusedLocals": true,
|
| 22 |
-
"noUnusedParameters": true,
|
| 23 |
-
"erasableSyntaxOnly": true,
|
| 24 |
-
"noFallthroughCasesInSwitch": true,
|
| 25 |
-
"noUncheckedSideEffectImports": true
|
| 26 |
-
},
|
| 27 |
-
"include": ["src"]
|
| 28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tsconfig.json
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"files": [],
|
| 3 |
-
"references": [
|
| 4 |
-
{ "path": "./tsconfig.app.json" },
|
| 5 |
-
{ "path": "./tsconfig.node.json" }
|
| 6 |
-
]
|
| 7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tsconfig.node.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"compilerOptions": {
|
| 3 |
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
| 4 |
-
"target": "ES2023",
|
| 5 |
-
"lib": ["ES2023"],
|
| 6 |
-
"module": "ESNext",
|
| 7 |
-
"types": ["node"],
|
| 8 |
-
"skipLibCheck": true,
|
| 9 |
-
|
| 10 |
-
/* Bundler mode */
|
| 11 |
-
"moduleResolution": "bundler",
|
| 12 |
-
"allowImportingTsExtensions": true,
|
| 13 |
-
"verbatimModuleSyntax": true,
|
| 14 |
-
"moduleDetection": "force",
|
| 15 |
-
"noEmit": true,
|
| 16 |
-
|
| 17 |
-
/* Linting */
|
| 18 |
-
"strict": true,
|
| 19 |
-
"noUnusedLocals": true,
|
| 20 |
-
"noUnusedParameters": true,
|
| 21 |
-
"erasableSyntaxOnly": true,
|
| 22 |
-
"noFallthroughCasesInSwitch": true,
|
| 23 |
-
"noUncheckedSideEffectImports": true
|
| 24 |
-
},
|
| 25 |
-
"include": ["vite.config.ts"]
|
| 26 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vite.config.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
import { defineConfig } from 'vite'
|
| 2 |
-
import react from '@vitejs/plugin-react'
|
| 3 |
-
|
| 4 |
-
// https://vite.dev/config/
|
| 5 |
-
export default defineConfig({
|
| 6 |
-
plugins: [react()],
|
| 7 |
-
base: "./", // relative paths for HF Space static hosting
|
| 8 |
-
optimizeDeps: {
|
| 9 |
-
// Don't pre-bundle transformers.js — it dynamically loads ONNX Runtime WASM/WebGPU
|
| 10 |
-
exclude: ["@huggingface/transformers"],
|
| 11 |
-
},
|
| 12 |
-
worker: {
|
| 13 |
-
format: "es",
|
| 14 |
-
},
|
| 15 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|