pycsamt.ai.processing.classify#
DimensionalityClassifier — MLP-based MT data dimensionality classifier.
Replaces the heuristic skew/ellipticity thresholds in
classify_dimensionality() with a
trained multi-layer perceptron that operates on per-(site, frequency)
phase-tensor-derived features.
Classes#
0 — 1-D (low skew, low ellipticity)
1 — 2-D (low skew, high ellipticity)
2 — 3-D (high skew / arbitrary ellipticity)
The network is also equipped with a regression head that predicts the geoelectric strike direction \(\alpha\) (in degrees, \(-90^\circ\) to \(90^\circ\)) for 2-D observations.
Feature vector (per site × frequency)#
[β_abs, ellipt_abs, logrho_det, phi_det, tip_amp]
where:
\(|\beta|\) — phase tensor skew (Caldwell 2004)
ellipt_abs— phase tensor ellipticity\(\log_{10}\rho_{\det}\) — determinant apparent resistivity
\(\phi_{\det}\) — determinant phase
tip_amp— tipper amplitude \(\sqrt{|T_x|^2 + |T_y|^2}\)
Integration with emtools#
Use from_features_table() to construct a ready-to-classify
instance from the DataFrame returned by
phase_features_table().
Classes
|
MLP classifier for MT data dimensionality (1-D / 2-D / 3-D). |
- class pycsamt.ai.processing.classify.DimensionalityClassifier(hidden=(128, 64), dropout=0.2, n_classes=3, lr=0.001, device=None)[source]#
Bases:
BaseEMProcessorMLP classifier for MT data dimensionality (1-D / 2-D / 3-D).
- Parameters:
hidden (tuple of int, default (128, 64)) – Hidden layer widths of the shared MLP backbone.
dropout (float, default 0.2) – Dropout probability in each hidden layer.
n_classes (int, default 3) – Number of dimensionality classes (0=1D, 1=2D, 2=3D).
lr (float, default 1e-3) – Default learning rate; can be overridden in
fit().device (str or None)
Notes
Falls back to a random-forest classifier (scikit-learn) when neither PyTorch nor TensorFlow is available.
Examples
>>> from pycsamt.ai.processing import DimensionalityClassifier >>> clf = DimensionalityClassifier() >>> clf.fit(X_train, y_train, epochs=30) DimensionalityClassifier(n_classes=3, torch) >>> clf.predict(X_test) array([0, 1, 2, ...]) >>> clf.predict_strike(X_2d) array([ 35., -12., ...])
- classmethod from_features_table(df, *, label_col='dim', strike_col=None, skew_th=3.0, ellipt_th=0.2, **fit_kwargs)[source]#
Construct and train a classifier from a
phase_features_table()DataFrame.- Parameters:
df (DataFrame)
label_col (str or None) – Column for pre-computed labels;
None→ rule-based labels.strike_col (str or None) – Column for strike direction in degrees.
skew_th (float) – Rule-based thresholds (used when
label_colis absent).ellipt_th (float) – Rule-based thresholds (used when
label_colis absent).**fit_kwargs – Passed to
fit()(e.g.epochs=50).
- Return type:
- fit(X, y=None, *, strike=None, epochs=80, batch_size=256, lr=None, val_frac=0.15, seed=None, verbose=True)[source]#
Train the dimensionality classifier.
- Parameters:
y (int ndarray (n_samples,) or None)
strike (float ndarray (n_samples,) or None)
epochs (int) – Training hyper-parameters.
batch_size (int) – Training hyper-parameters.
lr (float | None) – Training hyper-parameters.
val_frac (float) – Training hyper-parameters.
seed (int | None) – Training hyper-parameters.
verbose (bool) – Training hyper-parameters.
- Return type:
self