Created
July 13, 2018 13:58
-
-
Save parcmepperman/4582fb852dab329fb4f8f56009654119 to your computer and use it in GitHub Desktop.
Deep Learing lab 1 Team 6
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
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="PYTHON_MODULE" version="4"> | |
<component name="NewModuleRootManager"> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="jdk" jdkName="Python 3.6 (CS490)" jdkType="Python SDK" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/.idea/DL_Lab_1_Team6_Student24.iml" filepath="$PROJECT_DIR$/.idea/DL_Lab_1_Team6_Student24.iml" /> | |
</modules> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="PropertiesComponent"> | |
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" /> | |
</component> | |
</project> |
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
import numpy as np | |
import matplotlib.pyplot as plt | |
import tensorflow as tf | |
import xlrd | |
# Bitcoin market report from 2018 | |
loan_data = "BTC.xls" | |
# reading in of .xls data | |
loan_book = xlrd.open_workbook(loan_data, encoding_override="uft-8") | |
loan_sheet = loan_book.sheet_by_index(0) | |
data = np.asarray([[loan_sheet.row_values(i)[3], loan_sheet.row_values(i)[4]] | |
for i in range(1, loan_sheet.nrows)]) | |
n_samples = loan_sheet.nrows | |
# input 1 variables (Lowest daily value(x) & adjusted closing value(y)) | |
X = tf.placeholder(tf.float32, name='Low') | |
Y = tf.placeholder(tf.float32, name='Close') | |
# creating weights and biases | |
weight = tf.Variable(0.0, name='weights') | |
biases = tf.Variable(0.0, name='bias') | |
# model for predicting y | |
Y_predict = X * weight + biases | |
loss = tf.square(Y - Y_predict, name='loss') | |
# optimizing learning_rate to get the minimum loss, 0.1 * 10^-9 best fit line and least amount of loss | |
optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.000000001).minimize(loss) | |
init = tf.initialize_all_variables() | |
with tf.Session() as sess: | |
sess.run(init) | |
tf.summary.scalar('Prediction', Y_predict) | |
tf.summary.scalar('Loss', loss) | |
merged_summary = tf.summary.merge_all() | |
summary_writer = tf.summary.FileWriter('/Users/marcpepperman/Desktop/DL_Lab_1_Team6_Student24/graphs/linear_reg', | |
graph=tf.get_default_graph()) | |
# increase range to insure best possible regression line | |
for i in range(3000): | |
total_loss = 0 | |
for xs, ys in data: | |
_, l, summary = sess.run([optimizer, loss, merged_summary], feed_dict={X: xs, Y: ys}) | |
summary_writer.add_summary(summary, i) | |
total_loss += l | |
print('Epoch {0}: {1}'.format(i, total_loss / n_samples)) | |
weight, biases = sess.run([weight, biases]) | |
X, Y = data.T[0], data.T[1] | |
plt.plot(X, Y, 'bo', label='Real Data') | |
plt.plot(X, X * weight + biases, 'r', label='Predicted Data') | |
plt.legend() | |
plt.show() | |
plt.savefig('DL_Lab_Number_One.png') |
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
�K" @D%��A | |
brain.Event:2M�3@\ �h& Z�oD%��A"�> | |
H | |
LowPlaceholder* | |
dtype0* | |
_output_shapes | |
:* | |
shape: | |
J | |
ClosePlaceholder* | |
dtype0* | |
_output_shapes | |
:* | |
shape: | |
Z | |
weights/initial_valueConst* | |
_output_shapes | |
: * | |
valueB | |
* * | |
dtype0 | |
k | |
weights | |
VariableV2* | |
shared_name * | |
dtype0* | |
_output_shapes | |
: * | |
container * | |
shape: | |
� | |
weights/AssignAssignweightsweights/initial_value* | |
validate_shape(* | |
_output_shapes | |
: * | |
use_locking(* | |
T0* | |
_class | |
loc:@weights | |
^ | |
weights/readIdentityweights* | |
T0* | |
_class | |
loc:@weights* | |
_output_shapes | |
: | |
W | |
bias/initial_valueConst* | |
valueB | |
* * | |
dtype0* | |
_output_shapes | |
: | |
h | |
bias | |
VariableV2* | |
dtype0* | |
_output_shapes | |
: * | |
container * | |
shape: * | |
shared_name | |
� | |
bias/AssignAssignbiasbias/initial_value* | |
use_locking(* | |
T0* | |
_class | |
loc:@bias* | |
validate_shape(* | |
_output_shapes | |
: | |
U | |
bias/readIdentitybias* | |
T0* | |
_class | |
loc:@bias* | |
_output_shapes | |
: | |
@ | |
mulMulLowweights/read* | |
T0* | |
_output_shapes | |
: | |
= | |
addAddmul bias/read* | |
_output_shapes | |
:* | |
T0 | |
9 | |
subSubCloseadd* | |
T0* | |
_output_shapes | |
: | |
6 | |
lossSquaresub* | |
_output_shapes | |
:* | |
T0 | |
\ | |
gradients/ShapeShapeloss*# | |
_output_shapes | |
: | |
���������* | |
T0* | |
out_type0 | |
X | |
gradients/grad_ys_0Const* | |
_output_shapes | |
: * | |
valueB | |
* �?* | |
dtype0 | |
q | |
gradients/FillFillgradients/Shapegradients/grad_ys_0* | |
T0* | |
index_type0* | |
_output_shapes | |
: | |
o | |
gradients/loss_grad/ConstConst^gradients/Fill* | |
dtype0* | |
_output_shapes | |
: * | |
valueB | |
* @ | |
a | |
gradients/loss_grad/MulMulsubgradients/loss_grad/Const* | |
T0* | |
_output_shapes | |
: | |
l | |
gradients/loss_grad/Mul_1Mulgradients/Fillgradients/loss_grad/Mul* | |
T0* | |
_output_shapes | |
: | |
f | |
gradients/sub_grad/ShapeShapeClose* | |
T0* | |
out_type0*# | |
_output_shapes | |
: | |
��������� | |
f | |
gradients/sub_grad/Shape_1Shapeadd* | |
T0* | |
out_type0*# | |
_output_shapes | |
: | |
��������� | |
� | |
(gradients/sub_grad/BroadcastGradientArgsBroadcastGradientArgsgradients/sub_grad/Shapegradients/sub_grad/Shape_1*2 | |
_output_shapes | |
: | |
���������: | |
���������* | |
T0 | |
� | |
gradients/sub_grad/SumSumgradients/loss_grad/Mul_1(gradients/sub_grad/BroadcastGradientArgs* | |
keep_dims( * | |
Tidx0* | |
T0* | |
_output_shapes | |
: | |
� | |
gradients/sub_grad/ReshapeReshapegradients/sub_grad/Sumgradients/sub_grad/Shape* | |
_output_shapes | |
:* | |
T0* | |
Tshape0 | |
� | |
gradients/sub_grad/Sum_1Sumgradients/loss_grad/Mul_1*gradients/sub_grad/BroadcastGradientArgs:1* | |
_output_shapes | |
:* | |
keep_dims( * | |
Tidx0* | |
T0 | |
Z | |
gradients/sub_grad/NegNeggradients/sub_grad/Sum_1* | |
T0* | |
_output_shapes | |
: | |
� | |
gradients/sub_grad/Reshape_1Reshapegradients/sub_grad/Neggradients/sub_grad/Shape_1* | |
_output_shapes | |
:* | |
T0* | |
Tshape0 | |
g | |
#gradients/sub_grad/tuple/group_depsNoOp^gradients/sub_grad/Reshape^gradients/sub_grad/Reshape_1 | |
� | |
+gradients/sub_grad/tuple/control_dependencyIdentitygradients/sub_grad/Reshape$^gradients/sub_grad/tuple/group_deps* | |
T0*- | |
_class# | |
!loc:@gradients/sub_grad/Reshape* | |
_output_shapes | |
: | |
� | |
-gradients/sub_grad/tuple/control_dependency_1Identitygradients/sub_grad/Reshape_1$^gradients/sub_grad/tuple/group_deps* | |
_output_shapes | |
:* | |
T0*/ | |
_class% | |
#!loc:@gradients/sub_grad/Reshape_1 | |
d | |
gradients/add_grad/ShapeShapemul*# | |
_output_shapes | |
: | |
���������* | |
T0* | |
out_type0 | |
] | |
gradients/add_grad/Shape_1Const* | |
valueB * | |
dtype0* | |
_output_shapes | |
: | |
� | |
(gradients/add_grad/BroadcastGradientArgsBroadcastGradientArgsgradients/add_grad/Shapegradients/add_grad/Shape_1* | |
T0*2 | |
_output_shapes | |
: | |
���������: | |
��������� | |
� | |
gradients/add_grad/SumSum-gradients/sub_grad/tuple/control_dependency_1(gradients/add_grad/BroadcastGradientArgs* | |
keep_dims( * | |
Tidx0* | |
T0* | |
_output_shapes | |
: | |
� | |
gradients/add_grad/ReshapeReshapegradients/add_grad/Sumgradients/add_grad/Shape* | |
T0* | |
Tshape0* | |
_output_shapes | |
: | |
� | |
gradients/add_grad/Sum_1Sum-gradients/sub_grad/tuple/control_dependency_1*gradients/add_grad/BroadcastGradientArgs:1* | |
T0* | |
_output_shapes | |
:* | |
keep_dims( * | |
Tidx0 | |
� | |
gradients/add_grad/Reshape_1Reshapegradients/add_grad/Sum_1gradients/add_grad/Shape_1* | |
_output_shapes | |
: * | |
T0* | |
Tshape0 | |
g | |
#gradients/add_grad/tuple/group_depsNoOp^gradients/add_grad/Reshape^gradients/add_grad/Reshape_1 | |
� | |
+gradients/add_grad/tuple/control_dependencyIdentitygradients/add_grad/Reshape$^gradients/add_grad/tuple/group_deps* | |
T0*- | |
_class# | |
!loc:@gradients/add_grad/Reshape* | |
_output_shapes | |
: | |
� | |
-gradients/add_grad/tuple/control_dependency_1Identitygradients/add_grad/Reshape_1$^gradients/add_grad/tuple/group_deps* | |
T0*/ | |
_class% | |
#!loc:@gradients/add_grad/Reshape_1* | |
_output_shapes | |
: | |
d | |
gradients/mul_grad/ShapeShapeLow* | |
T0* | |
out_type0*# | |
_output_shapes | |
: | |
��������� | |
] | |
gradients/mul_grad/Shape_1Const* | |
valueB * | |
dtype0* | |
_output_shapes | |
: | |
� | |
(gradients/mul_grad/BroadcastGradientArgsBroadcastGradientArgsgradients/mul_grad/Shapegradients/mul_grad/Shape_1* | |
T0*2 | |
_output_shapes | |
: | |
���������: | |
��������� | |
{ | |
gradients/mul_grad/MulMul+gradients/add_grad/tuple/control_dependencyweights/read* | |
_output_shapes | |
:* | |
T0 | |
� | |
gradients/mul_grad/SumSumgradients/mul_grad/Mul(gradients/mul_grad/BroadcastGradientArgs* | |
T0* | |
_output_shapes | |
:* | |
keep_dims( * | |
Tidx0 | |
� | |
gradients/mul_grad/ReshapeReshapegradients/mul_grad/Sumgradients/mul_grad/Shape* | |
T0* | |
Tshape0* | |
_output_shapes | |
: | |
t | |
gradients/mul_grad/Mul_1MulLow+gradients/add_grad/tuple/control_dependency* | |
_output_shapes | |
:* | |
T0 | |
� | |
gradients/mul_grad/Sum_1Sumgradients/mul_grad/Mul_1*gradients/mul_grad/BroadcastGradientArgs:1* | |
_output_shapes | |
:* | |
keep_dims( * | |
Tidx0* | |
T0 | |
� | |
gradients/mul_grad/Reshape_1Reshapegradients/mul_grad/Sum_1gradients/mul_grad/Shape_1* | |
T0* | |
Tshape0* | |
_output_shapes | |
: | |
g | |
#gradients/mul_grad/tuple/group_depsNoOp^gradients/mul_grad/Reshape^gradients/mul_grad/Reshape_1 | |
� | |
+gradients/mul_grad/tuple/control_dependencyIdentitygradients/mul_grad/Reshape$^gradients/mul_grad/tuple/group_deps* | |
T0*- | |
_class# | |
!loc:@gradients/mul_grad/Reshape* | |
_output_shapes | |
: | |
� | |
-gradients/mul_grad/tuple/control_dependency_1Identitygradients/mul_grad/Reshape_1$^gradients/mul_grad/tuple/group_deps* | |
_output_shapes | |
: * | |
T0*/ | |
_class% | |
#!loc:@gradients/mul_grad/Reshape_1 | |
b | |
GradientDescent/learning_rateConst* | |
valueB | |
*���.* | |
dtype0* | |
_output_shapes | |
: | |
� | |
3GradientDescent/update_weights/ApplyGradientDescentApplyGradientDescentweightsGradientDescent/learning_rate-gradients/mul_grad/tuple/control_dependency_1* | |
_class | |
loc:@weights* | |
_output_shapes | |
: * | |
use_locking( * | |
T0 | |
� | |
0GradientDescent/update_bias/ApplyGradientDescentApplyGradientDescentbiasGradientDescent/learning_rate-gradients/add_grad/tuple/control_dependency_1* | |
_output_shapes | |
: * | |
use_locking( * | |
T0* | |
_class | |
loc:@bias | |
� | |
GradientDescentNoOp1^GradientDescent/update_bias/ApplyGradientDescent4^GradientDescent/update_weights/ApplyGradientDescent | |
+ | |
initNoOp^bias/Assign^weights/Assign | |
Z | |
Prediction/tagsConst* | |
valueB B | |
Prediction* | |
dtype0* | |
_output_shapes | |
: | |
R | |
Prediction | |
ScalarSummaryPrediction/tagsadd* | |
_output_shapes | |
: * | |
T0 | |
N | |
Loss/tagsConst* | |
valueB | |
BLoss* | |
dtype0* | |
_output_shapes | |
: | |
G | |
Loss | |
ScalarSummary Loss/tagsloss* | |
T0* | |
_output_shapes | |
: | |
U | |
Merge/MergeSummaryMergeSummary | |
PredictionLoss* | |
_output_shapes | |
: * | |
N"�.��& |