Skip to main content

Module common

Module common 

Source
Expand description

Common functionality for linear model Python bindings

This module contains shared imports, types, and utilities used across all linear model implementations.

Macros§

wrap_pyfunction
Wraps a Rust function annotated with #[pyfunction].

Structs§

Borrowed
A borrowed equivalent to Bound.
Bound
A Python thread-attached equivalent to Py<T>.
PerformanceStats
Performance monitoring structure
Py
A reference to an object allocated on the Python heap.
PyAny
Represents any Python object.
PyClassInitializer
Initializer for our #[pyclass] system.
PyErr
Represents a Python exception.
PyModule
Represents a Python module object.
PyRef
A wrapper type for an immutably borrowed value from a Bound<'py, T>.
PyRefMut
A wrapper type for a mutably borrowed value from a Bound<'py, T>.
PyValueError
Represents Python’s ValueError exception.
Python
A marker token that represents holding the GIL.

Enums§

SklearsPythonError
Enhanced error handling for sklears-python

Traits§

FromPyObject
Extract a type from a Python object.
FromPyObjectOwned
A data structure that can be extracted without borrowing any data from the input.
IntoPyObject
Defines a conversion from a Rust type to a Python object, which may fail.
PyAnyMethods
This trait represents the Python APIs which are usable on all Python objects.
PyBoolMethods
Implementation of functionality for PyBool.
PyByteArrayMethods
Implementation of functionality for PyByteArray.
PyBytesMethods
Implementation of functionality for PyBytes.
PyCapsuleMethods
Implementation of functionality for PyCapsule.
PyComplexMethods
Implementation of functionality for PyComplex.
PyDictMethods
Implementation of functionality for PyDict.
PyFloatMethods
Implementation of functionality for PyFloat.
PyFrozenSetMethods
Implementation of functionality for PyFrozenSet.
PyListMethods
Implementation of functionality for PyList.
PyMappingMethods
Implementation of functionality for PyMapping.
PyMappingProxyMethods
Implementation of functionality for PyMappingProxy.
PyModuleMethods
Implementation of functionality for PyModule.
PySequenceMethods
Implementation of functionality for PySequence.
PySetMethods
Implementation of functionality for PySet.
PySliceMethods
Implementation of functionality for PySlice.
PyStringMethods
Implementation of functionality for PyString.
PyTracebackMethods
Implementation of functionality for PyTraceback.
PyTupleMethods
Implementation of functionality for PyTuple.
PyTypeMethods
Implementation of functionality for PyType.
PyWeakrefMethods
Implementation of functionality for PyWeakref.

Functions§

calculate_r2_score
Calculate R² score with optimized array operations
check_memory_usage
Check memory usage and warn if arrays are very large
core_array1_to_py
Convert an ndarray Array1 into a Python-owned NumPy array object
core_array2_to_py
Convert an ndarray Array2 into a Python-owned NumPy array object
get_available_memory_mb
Get system memory information for better memory management
pyarray_to_core_array1
Convert a read-only NumPy array view into an owned SciRS2 ndarray Array1
pyarray_to_core_array2
Convert a read-only NumPy array view into an owned SciRS2 ndarray Array2
validate_finite_values
Validate that array contains only finite values
validate_finite_values_1d
Validate that 1D array contains only finite values
validate_fit_arrays
Validate input arrays for model fitting
validate_fit_arrays_enhanced
Enhanced validation functions with better error handling
validate_predict_array
Validate input arrays for prediction

Type Aliases§

Array1
one-dimensional array
Array2
two-dimensional array
LinearModelResult
Common error type for linear model operations
PyArray1
One-dimensional array.
PyArray2
Two-dimensional array.
PyReadonlyArray1
Read-only borrow of a one-dimensional array.
PyReadonlyArray2
Read-only borrow of a two-dimensional array.
PyResult
Represents the result of a Python call.

Attribute Macros§

pyclass
pyfunction
A proc macro used to expose Rust functions to Python.
pymethods
A proc macro used to expose methods to Python.
pymodule
A proc macro used to implement Python modules.

Derive Macros§

FromPyObject
IntoPyObject
IntoPyObjectRef