Guest User

Untitled

a guest
Nov 16th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import crime_data
  2. from keras.models import Sequential
  3.  
  4. # load crime dataset (financial, historical, social data, with labels Criminal/Not Criminal)
  5. dataframe = pandas.read_csv(crime_data.load(), header=None)
  6. X = dataset[:,0:60].astype(float)
  7. Y = dataset[:,60]
  8.  
  9. # Create Neural Network Model
  10. model = Sequential()
  11. model.add(Dense(12, input_dim=8, activation='relu'))
  12. model.add(Dense(8, activation='relu'))
  13. model.add(Dense(1, activation='sigmoid'))
  14. # Compile model
  15. model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
  16. # Fit the model
  17. model.fit(X, Y, epochs=150, batch_size=10)
  18.  
  19. # New potential criminal data
  20. new_person crime_data.load_new()
  21. # predict criminality (criminal/not criminal)
  22. scores = model.predict(new person)
Add Comment
Please, Sign In to add comment