Created
October 26, 2017 15:48
-
-
Save sencagri/3e330d9ecd90c039b7fd57d503f8364e to your computer and use it in GitHub Desktop.
Pattern Recognition P1 Q3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate 2 - class problem, using parametric classification | |
import numpy as np | |
den1 = 1 | |
den2 = 0.3 | |
var1 = den1 ** 2 | |
var2 = den2 ** 2 | |
mean1 = 3 | |
mean2 = 2 | |
a = (1/(2*var1)) - (1/(2*var2)) | |
b = (mean2/var2) - (mean1/var1) | |
c = (((mean1 ** 2) / (2 * var1)) - ((mean2 ** 2) / (2 * var2))) + np.log(den1 / den2) | |
x1 = -b | |
x1 += (b**2 - 4*a*c) ** (1/2) | |
x1 /= 2*a | |
x2 = -b | |
x2 -= (b**2 - 4*a*c) ** (1/2) | |
x2 /= 2*a | |
print("x1 point %s" %x1) | |
print("x2 point %s" %x2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment