Giter VIP home page Giter VIP logo

machine-learning-for-finance's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

machine-learning-for-finance's Issues

ImportError: cannot import name 'SGD' from 'keras.optimizers'

Hi,

And even with the help of SOF I still cannot reproduce the numbers you've got in your git. I'm getting the following:

Epoch 1/5
13013/13013 [==============================] - 17s 1ms/step - loss: 825128.0000 - acc: 0.8998 - val_loss: 211068.5156 - val_acc: 0.9019
Epoch 2/5
13013/13013 [==============================] - 16s 1ms/step - loss: 766153.7500 - acc: 0.9068 - val_loss: 582742.2500 - val_acc: 0.8027


ImportError Traceback (most recent call last)
in ()
1 from keras.models import Sequential
2 from keras.layers import Dense, Activation
----> 3 from keras.optimizers import SGD

ImportError: cannot import name 'SGD' from 'keras.optimizers' (/usr/local/lib/python3.7/dist-packages/keras/optimizers.py)


NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

At page 54 , investigate zero balances as a feature of fraud detection

Hi,

At page 54 of this book, there is a formula for counting origin accounts have insufficient funds. As the code below:

     len(dfOdd[(dfOdd.oldBalanceOrig <= dfOdd.amount)]) / len(dfOdd)

This formula get 0.89664... , close to 90% of the odd transactions have insufficient funds.
Since we want accounts of insufficient funds before transaction. why use " <= " not. " < " ?
( The latter one get 0.21762... )

Regards,
Steven

Answers for the exercises

@JannesKlaas
Hi Jannes,

Thank you for the amazing book and the tutorials, I really appreciate the time and effort you have put into the book.

I am wondering if there is somewhere that you have posted the answers of the exercieses for us to double check?
Since this is completely self-study, having answers to look up would be helpful to let me know that I am at least in the right direction.

Thanks.

NameError: name 'pred_func' is not defined

@JannesKlaas
Hi Jannes,
In chapater 1,
...
A deeper network
...

Helper function to plot a decision boundary.

If you don't fully understand this function don't worry, it just generates the contour plot below.

def plot_decision_boundary(pred_func):
# Set min and max values and give it some padding
x_min, x_max = X[:, 0].min() - .5, X[:, 0].max() + .5
y_min, y_max = X[:, 1].min() - .5, X[:, 1].max() + .5
h = 0.01
# Generate a grid of points with distance h between them
xx, yy = np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h))
# Predict the function value for the whole gid
Z = pred_func(np.c_[xx.ravel(), yy.ravel()])
Z = Z.reshape(xx.shape)
# Plot the contour and training examples
plt.contourf(xx, yy, Z, cmap=plt.cm.Spectral)
plt.scatter(X[:, 0], X[:, 1], c=y.flatten(), cmap=plt.cm.Spectral)


NameError Traceback (most recent call last)
/tmp/ipykernel_27/694468409.py in
15
16 #Plot the decision boundary
---> 17 plot_decision_boundary(lambda x: predict(model, x))
18 plt.title("Decision Boundary for hidden layer size 3")
19

/tmp/ipykernel_27/2764471563.py in plot_decision_boundary(pre_func)
114 xx, yy = np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h))
115 #Predict the function value for the whole gid
--> 116 Z = pred_func(np.c_[xx_ravel(), yy_ravel()])
117 Z = Z.reshape(xx.shape)
118 #Plot the contour and training examples

NameError: name 'pred_func' is not defined

TypeError: only integer scalar arrays can be converted to a scalar index

I keep getting this error, trying to solve it but havent be able to, I am using python 3.0 from mini-conda, thanks.

epoch = 5000 # Number of games played in training, I found the model needs about 4,000 games till it plays well

# Train the model
# For simplicity of the noteb
hist = train(model, epoch, verbose=1)

print("Training done")

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-11-1e110d42c25b> in <module>
      3 # Train the model
      4 # For simplicity of the noteb
----> 5 hist = train(model, epoch, verbose=1)
      6 
      7 print("Training done")

<ipython-input-10-b5900a520e40> in train(model, epochs, verbose)
     12         game_over = False
     13         # get initial input
---> 14         input_t = env.observe()
     15 
     16         while not game_over:

<ipython-input-2-a9f37a9957fc> in observe(self)
     57 
     58     def observe(self):
---> 59         canvas = self._draw_state()
     60         return canvas.reshape((1, -1))
     61 

<ipython-input-2-a9f37a9957fc> in _draw_state(self)
     36         canvas[state[0], state[1]] = 1  # draw fruit
     37 
---> 38         canvas[-1, state[2] -1:state[2] + 2] = 1  # draw basket
     39 
     40         return canvas

TypeError: only integer scalar arrays can be converted to a scalar index

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.