Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel Processing Logic #27

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Parallel Processing Logic #27

wants to merge 4 commits into from

Conversation

jdehorty
Copy link

Main point is the example of parallel processing logic, which I mentioned on our call. Feel free to scavenge whatever your need from this PR and modify the formatting to whatever your preference is.

jdehorty and others added 3 commits October 27, 2023 22:00
Made changes to the Multiple Regression class for performance improvement. Introduced parallel processing for better performance when handling large datasets. Methods were also modified to include additional options for customization, such as matrix decomposition and data normalization. Code structure was enhanced for better readability and comprehensibility.
Copy link
Owner

@ooples ooples left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general comment but I wasn't able to find any changes for what you talked about with adding customization options for stuff like Matrix Decomposition, etc so I feel like I'm just being blind

var inputs0Length = inputs[0].Length;

// Use parallel processing for large data sets
Parallel.For(0, inputsLength, i =>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the need for Parallel processing for large datasets but this will actually create a performance bottleneck for small to average sized datasets so we should dynamically use Parallel.For when the inputs Length is a certain minimum size

// Initialize predictions array and store lengths for optimization
var predictions = new double[inputs[0].Length];
var inputsLength = inputs.Length;
var inputs0Length = inputs[0].Length;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a minor issue but you are referencing the same inputs[0].Length on line 121 and 123 so you should move up your variable and use that variable for line 121

namespace AiDotNet.Regression;
using System;
using System.Threading.Tasks;
using MathNet.Numerics.LinearAlgebra;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is another minor issue but we moved all using statements to Helpers/UsingsHelper.cs so if you can please move the necessary using statements there.

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@ooples ooples self-requested a review February 4, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants