Skip to main content

Installation - How to install


The easiest way to install maclearn is using pip. Open your teminal and enter -
pip install maclearn



Instruction - How to use maclearn


Using maclearn in your project is simple enough. Currently, you'll find only 2 algorithms in this module. We are working to develop more.


Reading Excel Files (.csv/.xlsx)

Reading excel files using maclearn is quite easy.
Let's say we want to read this file (PizzaPrice.csv) -
Size  Price
 6  350
 8  775
 12  1150
 14  1395
 17  1648
 18  1675

The file may be in .xlsx or .csv format but the extension doesn't matter. Here's how to read it -
For .csv format -
        import maclearn # importing the module
        
        filename = "PizzaPrice.csv"  # Initialize the directory
        file = maclearn.csv(filename)  # Create a csv object
        data = file.data()  # Read the data and store it as a list
        print(data)  # Print the data


            Result - [[6, 8, 12, 14, 17, 18], [350, 775, 1150, 1395, 1648, 1675]]
  


For .xlsx format -

            import maclearn # importing the module
            
            filename = "PizzaPrice.xlsx"  # Initialize the directory
            file = maclearn.xlsx(filename)  # Create a xlsx object
            data = file.data()  # Read the data and store it as a list
            print(data)  # Print the data
  

            Result - [[6, 8, 12, 14, 17, 18], [350, 775, 1150, 1395, 1648, 1675]]
  


If you want, you can put file.data() in the fit method of GaussianNaiveBayes or LinearRegression in order to fit the data to your model from an excel file




Gaussian Naive Bayes Classifier

First create the object GaussianNaiveBayes()...
Then call the fit() method to fit the data to your model.
Note: Your data must be in this format - [Feature1, Feature2, Feature3, Label]...
Here, you can use as many features as you want...
After that, simply call the predict(*Features) method to predict the label....
You can calculate the F1 Measure for your model by simply calling the f1_measure() method.
You can also calculate the specificity for your model by simply calling the specificity() method.
Example:
        import maclearn # Importing the module
        # Features
        Outlook = ["Sunny", "Sunny", "Cloudy", "Sunny", "Cloudy", "Cloudy", "Sunny"]
        Temperature = ["Cold", "Warm", "Warm", "Warm", "Cold", "Cold", "Cold"]
        Routine = ["Indoor", "Outdoor", "Indoor", "Indoor", "Indoor", "Outdoor", "Outdoor", "Outdoor"]
        WearCoat = ["No", "No", "No", "No", "Yes", "Yes", "Yes"] # Labels
        
        # You can also import the data from an excel file
        Features = [Outlook, Temperature, Routine, WearCoat] # Putting all features in a list
        
        model = maclearn.GaussianNaiveBayes()  # Creating the object
        model.fit(Features) # Fit the data into the model

        # Should we wear coat, if our feature set is cloudy, warm and outdoor?
        print(model.predict("Cloudy", "Warm", "Outdoor")) # Predict the label
        f1_value = model.f1_measure() # Calculate the F1 measure value for the model
        specificity = model.specificity() # Calculate the specificity for the model
        print(f1_value * 100, "%") # print F1 measure value in percentage
        print(specificity * 100, "%") # print specificity in percentage



Linear Regression with numerical analysis

First create the object - LinearRegression()...
Then call the fit(x, y) method to fit the data to your model.
This model is for single variable linear regression. So your data must be in this format - X=[2,3,4], Y=[5,6,7]
Then, just call the predict(x) method with the argument of x value to predict the y value...
You can also calculate the R-Squared value by simply calling r_squared() method.
Example:
        import maclearn # Importing the module

        # You can also import the data from an excel file
        Size = [6, 8, 12, 14, 18] # Size of Pizza in inches (Independent Variable)
        Price = [350, 775, 1150, 1395, 1675] # Price of Pizza in Taka (Dependent Variable)
                    
        model = maclearn.LinearRegression()  # Creating the object
        model.fit(Size, Price) # Fit the data into the model

        predicted = model.predict(17) # Predicted the price of 17 inches pizza
        accuracy = model.r_squared() # Calculate the R-Squared value for the model

        print(predicted) # Print the predicted value
        print(accuracy * 100, "%") # Print the R-Squared value in percenntage



Lisence


This module is completely free and open source. You can use and modify to improve the module if you want ;)
Any suggestion will be highly appriciated. Gmail - neural.gen.official@gmail.com

Created by Sajedur Rahman Fiad

Release files for MacLearn 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for MacLearn 1.0.1
File Size Uploaded
MacLearn-1.0.1.tar.gz 5.5 kB Details

Release files / MacLearn-1.0.1.tar.gz

Download URL MacLearn-1.0.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
822d0ee36ddb277fd6f98676fefd808525174121c7c3165d881289fe533d7d08
BLAKE2b-256 checksum
How to use checksums
532b7707d73c7b42cff31a89d21deb51c6b51b5ced50c4f5cda8294fc2f04f2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.5

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page