Use this as your **complete final master prompt**: --- # FINAL MASTER PROMPT — Production Scientific AI/ML Prediction SaaS Platform Build a **production-ready, enterprise-grade, research-grade AI-powered scientific machine learning web platform** for: * Scientific prediction * Frequency extrapolation * Multi-model benchmarking * Scientific graph validation * Experiment tracking * Research export * Commercial SaaS deployment This platform must support: * THz datasets * S-parameter datasets * RF / Microwave datasets * Electromagnetic frequency-response datasets * Signal-processing datasets * General numerical scientific datasets The platform must be suitable for: * Universities * Research labs * Engineering companies * Industrial R&D * IEEE publication workflows * Commercial SaaS deployment --- # 1. Full Stack Architecture Frontend: * React + TypeScript * Responsive UI * Scientific dashboards * Real-time updates Backend: * Python + FastAPI Database: * PostgreSQL Caching: * Redis Background tasks: * Celery --- # 2. Authentication & Security Implement: * Register/Login * JWT authentication * Role-based access * Project isolation * Session security * Password hashing * Rate limiting * Audit logging * File validation * Input sanitization --- # 3. Supported ML Models Implement: * KNN Regressor * Decision Tree Regressor * Random Forest Regressor * AdaBoost Regressor * Gradient Boosting Regressor * XGBoost Regressor * Extra Trees Regressor * SVR * MLP Regressor Every model must preserve its own learning behavior. Never force identical curves across models. --- # 4. Dataset Upload & Validation Support: * CSV * Excel * TXT Automatically detect: * Input columns * Target columns * Frequency columns * Scientific measurement columns Validate: * Remove null rows * Remove corrupted rows * Remove duplicates * Validate numeric-only columns * Detect invalid scientific values Display: * Total rows * Valid rows * Removed rows * Feature columns * Target columns Reject invalid datasets. --- # 5. Training Pipeline Use proper ML workflow: Train/Test split: * 80/20 or configurable * Fixed random seed Never evaluate on training data. Automatically retrain when user changes: * Dataset * Features * Targets * Frequency range * Models * Preprocessing Never reuse stale models. --- # 6. Preprocessing Tree models: * Direct training Distance/Neural models: * KNN * SVR * MLP Must use: * StandardScaler or * MinMaxScaler Save preprocessing pipeline. --- # 7. Hyperparameter Optimization Use: * GridSearchCV or * RandomizedSearchCV Save best hyperparameters. Never rely only on defaults. --- # 8. Cross Validation Use: * 5-Fold or configurable K-Fold validation Display: * Mean score * Standard deviation * Stability score --- # 9. Evaluation Metrics For every model calculate: * MAE * MSE * RMSE * R² * MAPE Auto-rank models. Highlight best model. --- # 10. Overfitting Detection Compare: Training vs Testing performance. If large gap: Show: * Overfitting warning * Underfitting warning --- # 11. Prediction Pipeline (Mandatory Protocol) Every prediction must follow: User Input → Input Validation → Feature Processing → Scaling (if required) → Model Inference → Output Validation → Scientific Validation → Graph Rendering Never skip stages. --- # 12. User Input Compliance Whenever user changes: * Number of extrapolation points * Start frequency * End frequency * Frequency step * Manual frequency values * Target variable * Model selection Backend must: * Validate input * Accept valid scientific values * Recalculate predictions from scratch Never ignore user values. Never reuse cached outputs. --- # 13. Scientific Extrapolation Rules When user increases points: For every model: Generate new X values. For every new point: Run actual `.predict()` inference. Never: * Copy old values * Stretch old curves * Shift graph lines * Duplicate predictions * Use fake frontend interpolation Every point must come from real ML inference. --- # 14. Scientific Curve Rules For THz / S-parameter / frequency-domain data: Preserve: * Frequency continuity * Slope continuity * Peaks * Valleys * Resonance dips * Curvature transitions Predictions must never: * Drop vertically * Rise unnaturally * Become flat randomly * Repeat identical values * Zig-zag unnaturally * Show non-physical spikes * Show discontinuous jumps Reject unrealistic curves automatically. Never display invalid scientific predictions. --- # 15. Boundary & Confidence Protection If user enters values outside training range: Detect out-of-distribution extrapolation. System must: * Warn user * Mark low-confidence regions * Highlight extrapolated zones Never present low-confidence predictions as guaranteed truth. --- # 16. Model-Specific Prediction Rules KNN Regressor: * Follow nearest-neighbor logic SVR: * Respect kernel boundaries MLP Regressor: * Preserve nonlinear learned behavior Tree models: * Respect learned split boundaries Never force one model’s prediction behavior onto another. --- # 17. Graph System Build: 1. Actual vs Predicted 2. Frequency Extrapolation 3. Residual/Error Plot 4. Model Comparison Plot Use: * Plotly --- # 18. Graph Rendering Rules Actual: * Solid line * Thick stroke * Circle markers Predicted: * Dashed line * Thin stroke * Square/Triangle markers If overlap occurs: Apply visualization-only separation: * z-order * Marker differentiation * Adaptive spacing Never modify real values. Legend: Auto-place in emptiest region. Never cover curves. --- # 19. Dynamic Graph Updates Whenever user changes points: Regenerate all graphs using fresh predictions. Never reuse cached Y-values. --- # 20. Prediction Validation Layer Before graph rendering validate: * No NaN * No Infinity * No repeated fake sequences * No unrealistic spikes * No vertical collapse * No invalid derivative discontinuity If anomaly detected: Block rendering. Re-run: * Preprocessing * Inference * Validation --- # 21. Explainability Provide: Feature importance. Support: * SHAP --- # 22. Auto Model Recommendation Recommend best model based on: * Accuracy * Stability * Extrapolation quality * Scientific smoothness Not only R². --- # 23. Model Persistence Save models using: * Joblib Save: * Model * Scaler * Hyperparameters * Metrics * Metadata * Timestamp --- # 24. Experiment Tracking Save: * Dataset version * Model version * Random seed * Hyperparameters * User settings * Timestamp Support reproducibility. --- # 25. Export System Support: * CSV * Excel * JSON * PDF * PNG * SVG * TIFF Include: * Model info * Metrics * Graphs * Dataset info * Timestamp Publication quality exports only. --- # 26. Large Dataset Handling For 10k+ rows: * Chunk processing * Memory optimization * Background execution * Safe caching Prevent crashes. --- # 27. Fault Tolerance If one model fails: * Log error * Skip failed model * Continue remaining models Never crash full platform. --- # 28. Live Logs Show: Dataset uploaded... Validation complete... Preprocessing... Training... Hyperparameter tuning... Prediction... Graph rendering... Export ready... --- # 29. Notifications Notify users when: * Training completed * Export completed * Model failed * Dataset invalid Support: * Email * In-app notifications --- # 30. Admin Dashboard Build controls for: * Users * Storage * API usage * Failed jobs * Billing * System logs --- # 31. API Documentation Auto-generate: * Swagger UI --- # 32. SaaS Billing Architecture Prepare future billing with: * Stripe Plans: * Free * Research * Pro * Enterprise --- # 33. Deployment Support deployment on: * Docker * Render * Railway * Microsoft Azure * Amazon Web Services Must support: * Environment variables * Secure secrets * Monitoring * Logging * Production scaling --- Build this as a **real scientific AI platform**, not a demo or fake graph generator. Every prediction must follow actual machine learning rules, scientific continuity, model-specific behavior, and user-entered values.
Sign in to leave a comment
No tasks yet
Add a task now to track work. System-generated tasks will be added here later.
No completed page designs yet.
Completed design pages will appear here when they are ready to preview.
No user flows yet.
The User Flow Agent will generate per-persona navigation diagrams after SRD updates.
No completed page designs yet.
Completed design pages will appear here when they are ready to preview.
No user flows yet.
The User Flow Agent will generate per-persona navigation diagrams after SRD updates.
No comments yet. Be the first!