Created
October 17, 2017 03:20
-
-
Save elliotwoods/2acd612a608dea4fabbae358862a7c21 to your computer and use it in GitHub Desktop.
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
reals = np.float64([ | |
points | |
]) | |
virtuals = np.float64([ | |
points | |
]) | |
def reflect(real, plane): | |
return virtual | |
#because this is a test, we synethesise some data | |
def generateVirtuals(): | |
create a random plane | |
synthesise the virtuals data using your reflect function and your random plane | |
add some noise (have a variable for the amount of noise) | |
def functionToOptimize(parameters): | |
make plane from parameters | |
#presume reals and virtuals are same length here | |
error = 0 | |
for i in range(len(reals)): | |
thisError = reflect(reals[i], plane) - virtuals[i] | |
error += thisError ** 2 | |
return np.sqrt(error) | |
scipy.optimize(functionToOptimize, [0, 0, 0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment