geochemistrypi.data_mining package

Subpackages

Submodules

geochemistrypi.data_mining.aggregate module

Durable parent/child result metadata for the public all-models workflow.

child_result(parent_directory: Path, model: str, child_directory: Path, state: str, error: str | None = None) Dict[str, Any][source]
safe_child_error(error: BaseException) str[source]

Bound one child failure without exposing tracebacks or stopping siblings.

write_aggregate_manifest(parent_directory: Path, task: str, tuning: str, expected_models: Sequence[str], children: List[Dict[str, Any]]) Path[source]

Atomically publish one complete or partial aggregate summary.

geochemistrypi.data_mining.cli_pipeline module

cli_pipeline(training_data_path: str, application_data_path: str | None = None, data_source: DataSource | None = None, world_map_configuration: WorldMapConfiguration | None = None, tracking_root: str | None = None, existing_experiment_id: str | None = None) None[source]

The command line interface software for Geochemistry Pi. The business logic of this CLI software can be found in the figures in the README.md file. It provides three MLOps core functionalities:

  1. Continuous Training

  2. Machine Learning Lifecycle Management

  3. Model Inference

Parameters:
  • training_data_path (str) – The path of the training data.

  • application_data_path (str, optional) – The path of the application data, by default None

semantic_mode_number(selected_number: int, visible_options: list) int[source]

Map a visible menu position back to the stable full-mode number.

geochemistrypi.data_mining.constants module

geochemistrypi.data_mining.dash_pipeline module

dash_pipeline(requests_pathname_prefix: str = '/dash/') Dash[source]

主 Dash 应用

geochemistrypi.data_mining.datasets module

Read-only discovery metadata for built-in and Desktop CLI datasets.

exception DatasetCatalogError[source]

Bases: RuntimeError

Raised when dataset discovery cannot produce trustworthy metadata.

dataset_catalog(source: str = 'all') Dict[str, Any][source]

Return bounded JSON-ready dataset metadata without changing the filesystem.

dataset_catalog_json(source: str = 'all') str[source]
desktop_input_root() Path[source]

Return the same Desktop/geopi_input location used by the human CLI.

geochemistrypi.data_mining.enum_ module

class DataSource(value)[source]

Bases: Enum

An enumeration.

ANY_PATH = 'Any Path'
BUILT_IN = 'Built-in'
DESKTOP = 'Desktop'
class ModeOption(value)[source]

Bases: Enum

An enumeration.

ANOMALY_DETECTION = 'Anomaly Detection'
CLASSIFICATION = 'Classification'
CLUSTERING = 'Clustering'
DIMENSIONAL_REDUCTION = 'Dimensional Reduction'
REGRESSION = 'Regression'
class ModeOptionWithMissingValues(value)[source]

Bases: Enum

An enumeration.

CLASSIFICATION = 'Classification'
CLUSTERING = 'Clustering'
REGRESSION = 'Regression'

geochemistrypi.data_mining.router module

async delete_dataset(dataset_id: int, current_user=Depends(dependency=<function get_current_active_user>, use_cache=True, scope=None), db=Depends(dependency=<function get_db>, use_cache=True, scope=None))[source]
async get_all_datasets(current_user=Depends(dependency=<function get_current_active_user>, use_cache=True, scope=None), db=Depends(dependency=<function get_db>, use_cache=True, scope=None))[source]
get_all_datasets_open(db=Depends(dependency=<function get_db>, use_cache=True, scope=None))[source]
async get_basic_datasets_info(current_user=Depends(dependency=<function get_current_active_user>, use_cache=True, scope=None), db=Depends(dependency=<function get_db>, use_cache=True, scope=None))[source]
async get_dataset(dataset_id: int, current_user=Depends(dependency=<function get_current_active_user>, use_cache=True, scope=None), db=Depends(dependency=<function get_db>, use_cache=True, scope=None))[source]
async post_dataset(dataset: ~fastapi.datastructures.UploadFile = File(Ellipsis), current_user=Depends(dependency=<function get_current_active_user>, use_cache=True, scope=None), db=Depends(dependency=<function get_db>, use_cache=True, scope=None))[source]
async run_classification_pipeline(request: ~geochemistrypi.data_mining.schemas.ClassificationRunRequest, current_user=Depends(dependency=<function get_current_active_user>, use_cache=True, scope=None), db=Depends(dependency=<function get_db>, use_cache=True, scope=None))[source]

geochemistrypi.data_mining.run_time_series module

Production CLI orchestration for reproducible Time Series analysis.

load_time_series_data(input_path: Path, sheet: str = '0') DataFrame[source]

Load only the two public dataset formats without guessing legacy Excel.

main(argv: list | None = None) None[source]

Backward-compatible module runner delegating to the production workflow.

run_time_series_analysis(input_path: Path, output_root: Path, experiment_name: str, run_name: str, bin_width: float, iterations: int = 100, seed: int = 2025, sheet: str = '0', age_col: str = 'R_AGE', age_max_col: str = 'R_MAX_AGE', probability_col: str = 'SBAP', latitude_col: str = 'LATITUDE', longitude_col: str = 'LONGITUDE', age_unit: str = 'Ma', fit_curve: bool = True) Path[source]
run_time_series_dataframe(df: DataFrame, source_path: Path, output_root: Path, experiment_name: str, run_name: str, bin_width: float, iterations: int = 100, seed: int = 2025, age_col: str = 'R_AGE', age_max_col: str = 'R_MAX_AGE', probability_col: str = 'SBAP', latitude_col: str = 'LATITUDE', longitude_col: str = 'LONGITUDE', age_unit: str = 'Ma', fit_curve: bool = True) Path[source]

Run the shared validated numerical workflow and write standard outputs.

geochemistrypi.data_mining.schemas module

class BasicDatasetInfo(*, id: int, name: str, sequence: int)[source]

Bases: BaseModel

id: int
name: str
sequence: int
class ClassificationRunRequest(*, dataset_id: int, target_column: str, model_name: str, label_mapping: LabelMappingConfig | None = None, metric_average: Literal['micro', 'macro', 'weighted'] | None = None)[source]

Bases: BaseModel

用于接收前端触发机器学习训练的请求体

dataset_id: int
label_mapping: LabelMappingConfig | None
metric_average: Literal['micro', 'macro', 'weighted'] | None
model_name: str
target_column: str
class Dataset(*, id: int, name: str | None = None, json_data: str | None = None, sequence: int | None = None, user_id: int | None = None, model_config: dict = {'from_attributes': True})[source]

Bases: BaseModel

id: int
json_data: str | None
name: str | None
sequence: int | None
user_id: int | None
class Diagram(*, id: int, name: str | None = None, image: bytes | None = None, dataset_id: int | None = None, model_config: dict = {'from_attributes': True})[source]

Bases: BaseModel

dataset_id: int | None
id: int
image: bytes | None
name: str | None
class LabelMappingConfig(*, type: str, bins: List[float] | None = None, labels: List[str] | None = None, num_classes: int | None = None, mapping: Dict[str, str] | None = None)[source]

Bases: BaseModel

用于接收前端传来的多分类映射规则

bins: List[float] | None
labels: List[str] | None
mapping: Dict[str, str] | None
num_classes: int | None
type: str

geochemistrypi.data_mining.service module

read_all_datasets(db: Session, user_id: int)[source]
read_basic_datasets_info(db: Session, user_id: int)[source]
read_dataset(db: Session, user_id: int, dataset_id: int)[source]
remove_dataset(db: Session, user_id: int, dataset_id: int)[source]
upload_dataset(db: Session, user_id: int, json_dataset: str, dataset_name: str)[source]

geochemistrypi.data_mining.sql_models module

class Dataset(**kwargs)[source]

Bases: Base

diagrams
id
json_data
name
sequence
user
user_id
class Diagram(**kwargs)[source]

Bases: Base

dataset
dataset_id
id
image
name

Module contents