How n-ys-kk/pcmf works
Main Components
• Data Input:
– Represent the relational input matrices (e.g., matrix X for patient-disease and matrix Y for patient attributes).
• Core Algorithm Module (PCMF Engine):
– This includes the main class or function defined in Positive_CMF.py.
– Internal processes where the factor matrices (U, V^T, Z^T) are generated.
• Preprocessing / Transformation:
– Include the use of the softplus function to convert the raw factor matrices into positive values.
• Link Function Application:
– Show that after the softplus step, the module applies a link function (which could be sigmoid, linear, or log depending on the data range) to produce the predicted matrices (X′ and Y′).
• Training / Optimization Loop:
– Capture the iterative training process (using backpropagation and a suitable optimizer such as Adam) with configurable parameters (learning rate, number of optimization steps, etc.).
• Output:
– Clearly indicate the predicted matrices as outcomes and the extracted feature representations that can be used for subsequent analysis.
Relationships and Data Flow
• Data Flow:
– Inside the core module, show how the data flows first to the factorization block (which computes U, V, and Z) and then through a transformation block (applying the softplus function).
– From the transformed matrices, show two parallel flows where each is processed by a different link function (f₁ for the product of U′ and V′ to predict X′, and f₂ for the product of U′ and Z′ to predict Y′).
• Feedback Loop during Training:
– Indicate that the optimization loop adjusts the factor matrices by comparing predictions with the actual relational matrices over multiple iterations (train method).
Architectural Patterns and Design Principles
• Modular Design:
– The code is separated in a way that the core functionality is encapsulated under the src/PCMF directory. Each module has a clear responsibility (e.g., setting up the factorization, applying transformations, training).
• Reusability and Extensibility:
• Clear Separation of Concerns:
Relevant Technologies and Frameworks
• Python Package Structure:
– The presence of pyproject.toml indicates a modern packaging approach.
• Numerical / Machine Learning Libraries:
– Although not explicitly listed, hint at the dependency on libraries (e.g., NumPy, possibly TensorFlow or PyTorch if backpropagation is implemented using such frameworks) for optimization and numerical computations.
• Jupyter Notebooks for Demonstration:
– Optionally include a note that the example notebook in the examples folder is intended to guide the end user in applying the package.