<commit_before># Linear-Discriminant-Functions

Implementation of different variants of Linear Perceptron

## Example:

    >>> from perceptron import Perceptron
    >>> 
    >>> X = [(1, 6), (7, 2), (8, 9), (9, 9), (4, 8), (8, 5), (2, 1), (3, 3), (2, 4), (7, 1), (1, 3), (5, 2)]
    >>> y = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2]
    >>> 
    >>> testset = [(1, 5.5), (8, 1), (2, 6), (2, 4.5), (6, 1.5), (4, 3)]
    >>> 
    >>> # Single Sample Perceptron without Margin    
    ... clf = Perceptron(learning_rate=0.1, margin=0.0)
    >>> clf.MISSP(X, y)
    >>> clf.predict(testset)
    [1, 2, 1, 2, 2, 2]
    >>> clf.plot_boundary()

[![SSP](https://github.com/irshadbhat/Linear-Discriminant-Functions/img/SSP.png)](https://github.com/irshadbhat/Linear-Discriminant-Functions/img/SSP.png)

    >>> # Single Sample Perceptron with Margin    
    ... clf = Perceptron(learning_rate=0.1, margin=1.0)
    >>> clf.MISSP(X, y)
    >>> clf.predict(testset)
    [1, 1, 1, 2, 2, 2]
    >>> clf.plot_boundary()

[![MISSP](https://github.com/irshadbhat/Linear-Discriminant-Functions/img/SSP.png)](https://github.com/irshadbhat/Linear-Discriminant-Functions/img/MISSP.png)

    >>> # Margin Infused Relaxation Algorithm
    ... clf = Perceptron(learning_rate = 2.0, margin=1.0)
    >>> clf.MIRA(X, y)
    >>> clf.predict(testset)
    [1, 1, 1, 2, 2, 2]
    >>> clf.plot_boundary()

[![MIRA](https://github.com/irshadbhat/Linear-Discriminant-Functions/img/SSP.png)](https://github.com/irshadbhat/Linear-Discriminant-Functions/img/MIRA.png)


## Contact:

    <NAME>
    MS-CSE IIITH, Hyderabad
    <EMAIL>
    <EMAIL>
<commit_msg>initial commit<commit_after># Linear-Discriminant-Functions

Implementation of different variants of Linear Perceptron

## Example:

    >>> from perceptron import Perceptron
    >>> 
    >>> X = [(1, 6), (7, 2), (8, 9), (9, 9), (4, 8), (8, 5), (2, 1), (3, 3), (2, 4), (7, 1), (1, 3), (5, 2)]
    >>> y = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2]
    >>> 
    >>> testset = [(1, 5.5), (8, 1), (2, 6), (2, 4.5), (6, 1.5), (4, 3)]
    >>> 
    >>> # Single Sample Perceptron without Margin    
    ... clf = Perceptron(learning_rate=0.1, margin=0.0)
    >>> clf.MISSP(X, y)
    >>> clf.predict(testset)
    [1, 2, 1, 2, 2, 2]
    >>> clf.plot_boundary()

[![SSP](https://github.com/irshadbhat/Linear-Discriminant-Functions/blob/master/img/SSP.png)](https://github.com/irshadbhat/Linear-Discriminant-Functions/blob/master/img/SSP.png)

    >>> # Single Sample Perceptron with Margin    
    ... clf = Perceptron(learning_rate=0.1, margin=1.0)
    >>> clf.MISSP(X, y)
    >>> clf.predict(testset)
    [1, 1, 1, 2, 2, 2]
    >>> clf.plot_boundary()

[![MISSP](https://github.com/irshadbhat/Linear-Discriminant-Functions/blob/master/img/MISSP.png)](https://github.com/irshadbhat/Linear-Discriminant-Functions/blob/master/img/MISSP.png)

    >>> # Margin Infused Relaxation Algorithm
    ... clf = Perceptron(learning_rate = 2.0, margin=1.0)
    >>> clf.MIRA(X, y)
    >>> clf.predict(testset)
    [1, 1, 1, 2, 2, 2]
    >>> clf.plot_boundary()

[![MIRA](https://github.com/irshadbhat/Linear-Discriminant-Functions/blob/master/img/MIRA.png)](https://github.com/irshadbhat/Linear-Discriminant-Functions/blob/master/img/MIRA.png)


## Contact:

    <NAME>
    MS-CSE IIITH, Hyderabad
    <EMAIL>
    <EMAIL>

{'fraction_non_alphanumeric': 0.21497584541062803, 'fraction_numerical': 0.04891304347826087, 'mean_word_length': 3.1620603015075375, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 123, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6971897', 'n_tokens_mistral': 1532, 'n_tokens_neox': 1371, 'n_words': 259}