Skip to content

Instantly share code, notes, and snippets.

@franckjay
franckjay / Slim-1D_Conv.py
Last active January 22, 2018 21:21 — forked from jkleint/timeseries_cnn.py
Example of using Keras to implement a 1D convolutional neural network (CNN) for timeseries prediction.
"""
Example of using Keras to implement a 1D convolutional neural network (CNN) for timeseries prediction.
"""
inData.head()
def buildConvModel(nFilters,lenFilters,windowSize,nFeat):
model = Sequential((
#Layer 1: 1D Convolution
Verifying my Blockstack ID is secured with the address
1PNzdnhcrJtu5fdu7DEfiee7MBD8A1H24h https://explorer.blockstack.org/address/1PNzdnhcrJtu5fdu7DEfiee7MBD8A1H24h
04642eb14538f598ca95458a2e38d3360ce813394feb09c36b21b511416f489c62bcbd539f4584d194bd5f9ff8fa04c5fb70284880298a5bbd89a38807c2deebd1;elaberge
import logging as logger
from flask import Blueprint, jsonify, request
from .GoodReadsGraph import BuildGraph
main = Blueprint('main', __name__)
logger.debug("App starting")
# Build our Graph
BigGraph, titles_dict = BuildGraph()
logger.debug("Graph is built service")
output_URL = ""
@main.route('/input_book', methods=['POST'])
import logging as logger
from flask import Flask
def create_app():
app = Flask(__name__)
from .app import main
app.register_blueprint(main)
logger.debug("App registered")
return app
class Graph(object):
def __init__(self, reads):
"""
"""
# Edges in our graph
self.reads = reads
def _find_a_user(self, input_User, debug=False):
"""
class Read(object):
def __init__(self, User, Book, Author, rating=None):
"""
The edge connecting User, Book, and Author nodes
"""
if Book not in User.shelf:
User.shelf.append((Book, rating)) # User read this book and rated it.
if Author not in User.author_list:
User.author_list.append(Author)
self.user = User
class User(object):
def __init__(self,user_id):
self.user_id = user_id
self.shelf = [] # Books read
self.author_list = [] # Authors read
class Book(object):
def __init__(self, book_id, Author, ratings_5, popularity, image_url):
self.book_id = book_id
self.author = Author
self.author_id = Author.author_id
import React, {Component} from "react";
import './App.css';
import { Container } from "semantic-ui-react";
import { BookEntry } from "./components/BookEntry";
import { GrabBook } from "./components/GrabBook";
// Want to build this App?
// $ npm start
// Inside the directory with the src/ directory
function App() {
return (
import React, { useState } from 'react';
import { Form, Input, Button } from 'semantic-ui-react';
export const BookEntry = () => {
const [title, setTitle] = useState(''); // Empty String
return (
<Form>
<Form.Field>
<Input