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
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, String, Float, ForeignKey, DateTime | |
from clickhouse_sqlalchemy import Table, make_session, get_declarative_base, types, engines | |
from sqlalchemy.orm import relationship | |
from sqlalchemy import create_engine, Column, MetaData, literal | |
engine = create_engine('clickhouse://default:@127.0.0.1:8123/test_db') | |
session = make_session(engine) | |
metadata = MetaData(bind=engine) | |
Base = get_declarative_base(metadata=metadata) |
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
""" | |
A weighted version of categorical_crossentropy for keras (2.0.6). This lets you apply a weight to unbalanced classes. | |
@url: https://gist.github.com/wassname/ce364fddfc8a025bfab4348cf5de852d | |
@author: wassname | |
""" | |
from keras import backend as K | |
def weighted_categorical_crossentropy(weights): | |
""" | |
A weighted version of keras.objectives.categorical_crossentropy | |