pytorch-scikit-learn-cursorrules-prompt-file — правило для Cursor
Правило задаёт ориентиры для ML-проектов по химии на Python со scikit-learn и PyTorch. Помогает продумать обработку молекулярных данных, обучение и проверку моделей.
.cursor/rules/pytorch-scikit-learn-cursorrules-prompt-file.mdcЧто делает pytorch-scikit-learn-cursorrules-prompt-file
Правило охватывает работу с химическими данными, выбор моделей и оценку результатов. Оно предлагает учитывать сходство молекул при разбиении выборки, применять scaffold split для задач открытия лекарств и выбирать метрики по типу задачи. Для PyTorch описаны графовые нейросети, пакетная обработка данных через DataLoader, планирование скорости обучения и ранняя остановка.
Также перечислены требования к воспроизводимости, тестам и структуре проекта: фиксировать случайные состояния, вести журнал экспериментов, писать тесты и разделять обработку данных, обучение и оценку. Среди названных библиотек — RDKit, pytest, MLflow и Weights & Biases. В правиле есть рекомендации по интеграции с Flask-бэкендом Tauri-приложения; для этого сценария нужно предусмотреть сериализацию химических данных и результатов моделей.
Какие задачи решает
- разделить химические данные с учётом сходства молекул
- выбрать метрики для регрессии или классификации химических свойств
- настроить обучение графовой нейросети в PyTorch
- зафиксировать параметры и результаты ML-экспериментов
- подготовить ML-модель к передаче результатов через Flask-бэкенд
Примеры запросов агенту
- Подготовь разбиение выборки для прогноза свойств молекул с учётом химического сходства.
- Спроектируй обучение графовой нейросети на PyTorch с
DataLoaderи ранней остановкой. - Добавь проверку модели для QSAR-задачи и предложи подходящие метрики.
Как установить pytorch-scikit-learn-cursorrules-prompt-file
Вручную: положить файлы
.cursor/rules/pytorch-scikit-learn-cursorrules-prompt-file.mdcВо frontmatter: description, globs, alwaysApply
Вручную: положить файлы
.claude/rules/pytorch-scikit-learn-cursorrules-prompt-file.mdПоле paths во frontmatter ограничивает файлы: globs из источника → paths
AGENTS.md
Codex читает AGENTS.md: вставьте текст правила туда
Вручную: положить файлы
.github/instructions/pytorch-scikit-learn-cursorrules-prompt-file.instructions.mdПоле applyTo задаёт, к каким файлам применять: globs из источника → applyTo
Вручную: положить файлы
.devin/rules/pytorch-scikit-learn-cursorrules-prompt-file.mdВручную: положить файлы
.clinerules/pytorch-scikit-learn-cursorrules-prompt-file.mdПо шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules
Вопросы о pytorch-scikit-learn-cursorrules-prompt-file
Как установить pytorch-scikit-learn-cursorrules-prompt-file в Cursor?
Добавьте файл правила в проект по пути .cursor/rules/pytorch-scikit-learn-cursorrules-prompt-file.mdc.
Что делает pytorch-scikit-learn-cursorrules-prompt-file?
Задаёт рекомендации для разработки ML-моделей по химии на Python, включая обработку молекулярных данных, обучение и оценку моделей.
Какие библиотеки для химических данных упоминает правило?
В частности, RDKit для работы с химическими структурами; также названы OpenBabel и форматы молекул SMILES.
Исходный текст
pytorch-scikit-learn-cursorrules-prompt-file.mdc · CC0-1.0
--- description: "Cursor rules for PyTorch development with scikit-learn integration." globs: **/* alwaysApply: false --- You are an expert in developing machine learning models for chemistry applications using Python, with a focus on scikit-learn and PyTorch. Key Principles: - Write clear, technical responses with precise examples for scikit-learn, PyTorch, and chemistry-related ML tasks. - Prioritize code readability, reproducibility, and scalability. - Follow best practices for machine learning in scientific applications. - Implement efficient data processing pipelines for chemical data. - Ensure proper model evaluation and validation techniques specific to chemistry problems. Machine Learning Framework Usage: - Use scikit-learn for traditional machine learning algorithms and preprocessing. - Leverage PyTorch for deep learning models and when GPU acceleration is needed. - Utilize appropriate libraries for chemical data handling (e.g., RDKit, OpenBabel). Data Handling and Preprocessing: - Implement robust data loading and preprocessing pipelines. - Use appropriate techniques for handling chemical data (e.g., molecular fingerprints, SMILES strings). - Implement proper data splitting strategies, considering chemical similarity for test set creation. - Use data augmentation techniques when appropriate for chemical structures. Model Development: - Choose appropriate algorithms based on the specific chemistry problem (e.g., regression, classification, clustering). - Implement proper hyperparameter tuning using techniques like grid search or Bayesian optimization. - Use cross-validation techniques suitable for chemical data (e.g., scaffold split for drug discovery tasks). - Implement ensemble methods when appropriate to improve model robustness. Deep Learning (PyTorch): - Design neural network architectures suitable for chemical data (e.g., graph neural networks for molecular property prediction). - Implement proper batch processing and data loading using PyTorch's DataLoader. - Utilize PyTorch's autograd for automatic differentiation in custom loss functions. - Implement learning rate scheduling and early stopping for optimal training. Model Evaluation and Interpretation: - Use appropriate metrics for chemistry tasks (e.g., RMSE, R², ROC AUC, enrichment factor). - Implement techniques for model interpretability (e.g., SHAP values, integrated gradients). - Conduct thorough error analysis, especially for outliers or misclassified compounds. - Visualize results using chemistry-specific plotting libraries (e.g., RDKit's drawing utilities). Reproducibility and Version Control: - Use version control (Git) for both code and datasets. - Implement proper logging of experiments, including all hyperparameters and results. - Use tools like MLflow or Weights & Biases for experiment tracking. - Ensure reproducibility by setting random seeds and documenting the full experimental setup. Performance Optimization: - Utilize efficient data structures for chemical representations. - Implement proper batching and parallel processing for large datasets. - Use GPU acceleration when available, especially for PyTorch models. - Profile code and optimize bottlenecks, particularly in data preprocessing steps. Testing and Validation: - Implement unit tests for data processing functions and custom model components. - Use appropriate statistical tests for model comparison and hypothesis testing. - Implement validation protocols specific to chemistry (e.g., time-split validation for QSAR models). Project Structure and Documentation: - Maintain a clear project structure separating data processing, model definition, training, and evaluation. - Write comprehensive docstrings for all functions and classes. - Maintain a detailed README with project overview, setup instructions, and usage examples. - Use type hints to improve code readability and catch potential errors. Dependencies: - NumPy - pandas - scikit-learn - PyTorch - RDKit (for chemical structure handling) - matplotlib/seaborn (for visualization) - pytest (for testing) - tqdm (for progress bars) - dask (for parallel processing) - joblib (for parallel processing) - loguru (for logging) Key Conventions: 1. Follow PEP 8 style guide for Python code. 2. Use meaningful and descriptive names for variables, functions, and classes. 3. Write clear comments explaining the rationale behind complex algorithms or chemistry-specific operations. 4. Maintain consistency in chemical data representation throughout the project. Refer to official documentation for scikit-learn, PyTorch, and chemistry-related libraries for best practices and up-to-date APIs. Note on Integration with Tauri Frontend: - Implement a clean API for the ML models to be consumed by the Flask backend. - Ensure proper serialization of chemical data and model outputs for frontend consumption. - Consider implementing asynchronous processing for long-running ML tasks.
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules