pub struct PythonInterop;Expand description
Python interoperability utilities
Implementations§
Source§impl PythonInterop
impl PythonInterop
Sourcepub fn array_to_python_buffer(array: &Array1<f64>) -> PyArrayBuffer
pub fn array_to_python_buffer(array: &Array1<f64>) -> PyArrayBuffer
Convert Rust array to Python-compatible format
Sourcepub fn array2_to_python_buffer(array: &Array2<f64>) -> PyArrayBuffer
pub fn array2_to_python_buffer(array: &Array2<f64>) -> PyArrayBuffer
Convert 2D Rust array to Python-compatible format
Sourcepub fn python_buffer_to_array(
buffer: &PyArrayBuffer,
) -> UtilsResult<Array1<f64>>
pub fn python_buffer_to_array( buffer: &PyArrayBuffer, ) -> UtilsResult<Array1<f64>>
Create Rust array from Python buffer
Sourcepub fn python_buffer_to_array2(
buffer: &PyArrayBuffer,
) -> UtilsResult<Array2<f64>>
pub fn python_buffer_to_array2( buffer: &PyArrayBuffer, ) -> UtilsResult<Array2<f64>>
Create 2D Rust array from Python buffer
Sourcepub fn generate_numpy_import_code(
array_name: &str,
buffer: &PyArrayBuffer,
) -> String
pub fn generate_numpy_import_code( array_name: &str, buffer: &PyArrayBuffer, ) -> String
Generate Python numpy import code
Sourcepub fn generate_function_call_template(
function_name: &str,
parameters: &[PythonParameter],
) -> String
pub fn generate_function_call_template( function_name: &str, parameters: &[PythonParameter], ) -> String
Generate Python function call template
Sourcepub fn create_ml_script(
model_type: &str,
training_data: &PyArrayBuffer,
labels: &PyArrayBuffer,
hyperparameters: &HashMap<String, f64>,
) -> UtilsResult<String>
pub fn create_ml_script( model_type: &str, training_data: &PyArrayBuffer, labels: &PyArrayBuffer, hyperparameters: &HashMap<String, f64>, ) -> UtilsResult<String>
Create Python script for ML model
Auto Trait Implementations§
impl Freeze for PythonInterop
impl RefUnwindSafe for PythonInterop
impl Send for PythonInterop
impl Sync for PythonInterop
impl Unpin for PythonInterop
impl UnwindSafe for PythonInterop
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more