Skip to content

Commit

Permalink
Refactor featurefactory to featurehub
Browse files Browse the repository at this point in the history
  • Loading branch information
micahjsmith committed Aug 12, 2017
1 parent ddcb2be commit bb30318
Show file tree
Hide file tree
Showing 31 changed files with 114 additions and 114 deletions.
24 changes: 12 additions & 12 deletions deploy/.env
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
DOCKER_NETWORK_NAME=featurefactory-network
HUB_IMAGE_NAME=featurefactoryhub
HUB_CONTAINER_NAME=featurefactoryhub
DOCKER_NETWORK_NAME=featurehub-network
HUB_IMAGE_NAME=featurehubhub
HUB_CONTAINER_NAME=featurehubhub
HUB_API_PORT=8081
FF_IMAGE_NAME=featurefactoryuser
FF_CONTAINER_NAME=featurefactoryuser
FF_DATA_DIR=/var/lib/featurefactory
FF_PROJECT_NAME=featurefactory
FF_IMAGE_NAME=featurehubuser
FF_CONTAINER_NAME=featurehubuser
FF_DATA_DIR=/var/lib/featurehub
FF_PROJECT_NAME=featurehub
FF_DOMAIN_NAME=
FF_DOMAIN_EMAIL=
FF_IDLE_SERVER_TIMEOUT=3600
FF_CONTAINER_MEMLIMIT=4G
MYSQL_CONTAINER_NAME=featurefactorymysql
MYSQL_CONTAINER_NAME=featurehubmysql
MYSQL_ROOT_USERNAME=root
MYSQL_ROOT_PASSWORD=
MYSQL_DATABASE=featurefactory
MYSQL_DATABASE=featurehub
MYSQL_DATA_VOLUME_NAME=db-data
SECRETS_VOLUME_NAME=secrets
USE_LETSENCRYPT_CERT=yes
EVAL_IMAGE_NAME=featurefactoryeval
EVAL_CONTAINER_NAME=featurefactoryeval
EVAL_IMAGE_NAME=featurehubeval
EVAL_CONTAINER_NAME=featurehubeval
EVAL_CONTAINER_PORT=5000
EVAL_API_TOKEN=
EVAL_FLASK_DEBUG=
HUB_CLIENT_API_TOKEN=
DISCOURSE_DOMAIN_NAME=
DISCOURSE_CLIENT_API_USERNAME=featurefactory
DISCOURSE_CLIENT_API_USERNAME=featurehub
DISCOURSE_CLIENT_API_TOKEN=
DISCOURSE_FEATURE_GROUP_NAME=writers
DISCOURSE_FEATURE_CATEGORY_NAME=features
Expand Down
4 changes: 2 additions & 2 deletions deploy/Dockerfile-eval
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM featurefactoryuser
FROM featurehubuser

CMD ["/opt/conda/bin/python", "-m", "featurefactory.evaluation.server"]
CMD ["/opt/conda/bin/python", "-m", "featurehub.evaluation.server"]
6 changes: 3 additions & 3 deletions deploy/Dockerfile-user
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ RUN rm -rf /home/jovyan
RUN apt-get update && apt-get install -y libmysqlclient-dev && rm -rf /var/lib/apt/lists/*
RUN /opt/conda/bin/pip install --egg mysql-connector-python-rf

# Install featurefactory into site-packages
# Install featurehub into site-packages
# TODO make this not python3.5 hardcoded
WORKDIR /opt/conda/lib/python3.5/site-packages
COPY requirements.txt requirements.txt
RUN /opt/conda/bin/pip install -r requirements.txt
COPY src featurefactory
WORKDIR featurefactory
COPY src featurehub
WORKDIR featurehub
RUN /opt/conda/bin/python setup.py install

# Same as jupyterhub/systemuser
Expand Down
2 changes: 1 addition & 1 deletion deploy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ setup_files:
sudo cp ./jupyterhub_config.py $(FF_DATA_DIR)/config/jupyterhub/
sudo cp ./userlist $(FF_DATA_DIR)/config/jupyterhub/ 2>/dev/null || true
sudo cp ./cull_idle_servers.py $(FF_DATA_DIR)/config/jupyterhub
sudo cp ../share/static/images/featurefactory.png $(FF_DATA_DIR)/config/jupyterhub
sudo cp ../share/static/images/featurehub.png $(FF_DATA_DIR)/config/jupyterhub

.PHONY: teardown_files
teardown_files:
Expand Down
2 changes: 1 addition & 1 deletion deploy/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

jupyterhub_config_dir = os.path.join(ff_data_dir, "config", "jupyterhub")

logo_file = os.path.join(ff_data_dir, "config", "jupyterhub", "featurefactory.png")
logo_file = os.path.join(ff_data_dir, "config", "jupyterhub", "featurehub.png")
cull_idle_filename = os.path.join(jupyterhub_config_dir, "cull_idle_servers.py")
if "FF_IDLE_SERVER_TIMEOUT" in os.environ:
cull_idle_timeout = os.environ["FF_IDLE_SERVER_TIMEOUT"]
Expand Down
2 changes: 1 addition & 1 deletion deploy/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import docker

# constants
RESOURCES_DIRNAME = "/var/log/featurefactory/resources/"
RESOURCES_DIRNAME = "/var/log/featurehub/resources/"
STATS_TYPES = [
"pids_stats",
"memory_stats",
Expand Down
2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
src/featurefactory.*rst
src/featurehub.*rst
src/modules.rst
server.pid
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SPHINXBUILD = sphinx-build
SPHINXPROJ = FeatureHub
SOURCEDIR = src
BUILDDIR = _build
PROJDIR = ../src/featurefactory
PROJDIR = ../src/featurehub

.PHONY: help
help:
Expand Down
14 changes: 7 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
import sys

sys.path.insert(0, os.path.abspath('../../src'))
sys.path.insert(0, os.path.abspath('../../src/featurefactory'))
sys.path.insert(0, os.path.abspath('../../src/featurefactory/user'))
sys.path.insert(0, os.path.abspath('../../src/featurefactory/admin'))
sys.path.insert(0, os.path.abspath('../../src/featurefactory/problems'))
sys.path.insert(0, os.path.abspath('../../src/featurefactory/evaluation'))
sys.path.insert(0, os.path.abspath('../../src/featurefactory/modeling'))
sys.path.insert(0, os.path.abspath('../../src/featurehub'))
sys.path.insert(0, os.path.abspath('../../src/featurehub/user'))
sys.path.insert(0, os.path.abspath('../../src/featurehub/admin'))
sys.path.insert(0, os.path.abspath('../../src/featurehub/problems'))
sys.path.insert(0, os.path.abspath('../../src/featurehub/evaluation'))
sys.path.insert(0, os.path.abspath('../../src/featurehub/modeling'))

from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify
Expand Down Expand Up @@ -171,7 +171,7 @@ def setup(app):
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'featurefactory', 'FeatureHub Documentation',
(master_doc, 'featurehub', 'FeatureHub Documentation',
[author], 1)
]

Expand Down
4 changes: 2 additions & 2 deletions docs/src/Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"outputs": [],
"source": [
"from featurefactory.problems.demo import commands"
"from featurehub.problems.demo import commands"
]
},
{
Expand Down Expand Up @@ -505,7 +505,7 @@
"\n",
"- Check out the FeatureHub [User Guide](https://hdi-project.github.io/FeatureHub/user-guide.html)\n",
"- Check out the FeatureHub [FAQ](https://hdi-project.github.io/FeatureHub/faq.html)\n",
"- Ask for help on the FeatureHub [forum](https://discourse.featurefactory.net)"
"- Ask for help on the FeatureHub [forum](https://discourse.featurehub.net)"
]
}
],
Expand Down
10 changes: 5 additions & 5 deletions src/featurefactory/admin/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy_utils import database_exists, create_database, drop_database

from featurefactory.admin.sqlalchemy_declarative import (
from featurehub.admin.sqlalchemy_declarative import (
Base, Feature, Problem, User, Metric, EvaluationAttempt
)
from featurefactory.admin.sqlalchemy_main import ORMManager
from featurefactory.util import possibly_talking_action
from featurehub.admin.sqlalchemy_main import ORMManager
from featurehub.util import possibly_talking_action


class Commands(object):
Expand All @@ -20,7 +20,7 @@ class Commands(object):
features.
"""

def __init__(self, problem=None, database="featurefactory"):
def __init__(self, problem=None, database="featurehub"):
"""Create the ORMManager and connect to DB.
If problem name is given, load it.
Expand All @@ -29,7 +29,7 @@ def __init__(self, problem=None, database="featurefactory"):
----------
problem : str, optional (default=None)
Name of problem
database : str, optional (default="featurefactory")
database : str, optional (default="featurehub")
Name of database within DBMS.
"""

Expand Down
2 changes: 1 addition & 1 deletion src/featurefactory/admin/sqlalchemy_main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from featurefactory.admin.sqlalchemy_declarative import Base
from featurehub.admin.sqlalchemy_declarative import Base
from configparser import ConfigParser, NoSectionError
import os
from contextlib import contextmanager
Expand Down
12 changes: 6 additions & 6 deletions src/featurefactory/evaluation/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import traceback
from urllib.parse import quote_from_bytes

from featurefactory.util import (
from featurehub.util import (
compute_dataset_hash, run_isolated, get_source, possibly_talking_action,
myhash
)
from featurefactory.admin.sqlalchemy_declarative import Problem, Feature
from featurefactory.evaluation import EvaluationResponse
from featurefactory.modeling import Model
from featurehub.admin.sqlalchemy_declarative import Problem, Feature
from featurehub.evaluation import EvaluationResponse
from featurehub.modeling import Model

class EvaluatorClient(object):
def __init__(self, problem_id, username, orm, dataset={}, target=None,
Expand Down Expand Up @@ -82,7 +82,7 @@ def submit(self, feature, description):
description : str
Feature description
"""
from featurefactory.user.session import Session
from featurehub.user.session import Session
feature_dill = quote_from_bytes(dill.dumps(feature))
code = get_source(feature)
data = {
Expand Down Expand Up @@ -149,7 +149,7 @@ def evaluate(self, feature):
return metrics_user

def _log_evaluation_attempt(self, feature):
from featurefactory.user.session import Session
from featurehub.user.session import Session
code = get_source(feature)
data = {
"database" : self.orm.database,
Expand Down
4 changes: 2 additions & 2 deletions src/featurefactory/evaluation/response.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from flask import Response
from featurefactory.modeling import MetricList
from featurefactory.util import TRY_AGAIN_LATER
from featurehub.modeling import MetricList
from featurehub.util import TRY_AGAIN_LATER

class EvaluationResponse(Response):
"""Wrapper class for response from evaluation server.
Expand Down
12 changes: 6 additions & 6 deletions src/featurefactory/evaluation/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
from flask import Flask, redirect, request, Response
import logging
# from jupyterhub.services.auth import HubAuth
from featurefactory.evaluation.future import HubAuth
from featurehub.evaluation.future import HubAuth

# FeatureHub imports
import hashlib
import dill
from urllib.parse import unquote_to_bytes
from logging.handlers import RotatingFileHandler
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from featurefactory.evaluation import EvaluationResponse, EvaluatorServer
from featurefactory.admin.sqlalchemy_main import ORMManager
from featurefactory.admin.sqlalchemy_declarative import (
from featurehub.evaluation import EvaluationResponse, EvaluatorServer
from featurehub.admin.sqlalchemy_main import ORMManager
from featurehub.admin.sqlalchemy_declarative import (
Feature, Problem, User, Metric, EvaluationAttempt)
from featurefactory.evaluation.discourse import post_feature
from featurefactory.util import (
from featurehub.evaluation.discourse import post_feature
from featurehub.util import (
get_function, myhash, is_positive_env)

# setup
Expand Down
6 changes: 3 additions & 3 deletions src/featurefactory/modeling/metrics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import MutableSequence
import featurefactory.modeling.model
import featurehub.modeling.model

import numpy as np
from sklearn.metrics import mean_squared_error
Expand Down Expand Up @@ -98,10 +98,10 @@ def find_in_list(list_):
return d["scoring"]
return None

result = find_in_list(featurefactory.modeling.model.Model.CLASSIFICATION_SCORING)
result = find_in_list(featurehub.modeling.model.Model.CLASSIFICATION_SCORING)
if result is not None:
return result
result = find_in_list(featurefactory.modeling.model.Model.REGRESSION_SCORING)
result = find_in_list(featurehub.modeling.model.Model.REGRESSION_SCORING)
if result is not None:
return result

Expand Down
6 changes: 3 additions & 3 deletions src/featurefactory/modeling/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from sklearn.preprocessing import label_binarize
from sklearn.model_selection import KFold, StratifiedKFold
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
from featurefactory.modeling.metrics import Metric, MetricList
from featurefactory.util import RANDOM_STATE
from featurehub.modeling.metrics import Metric, MetricList
from featurehub.util import RANDOM_STATE

# automl
import autosklearn.classification
import autosklearn.regression
from featurefactory.modeling.metrics import rmsle_scorer, ndcg_scorer
from featurehub.modeling.metrics import rmsle_scorer, ndcg_scorer

class Model(object):
"""Versatile modeling object.
Expand Down
6 changes: 3 additions & 3 deletions src/featurefactory/problems/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

from sqlalchemy.exc import ProgrammingError

from featurefactory.user.session import Session
from featurefactory.admin.admin import Commands
from featurehub.user.session import Session
from featurehub.admin.admin import Commands

try:
for _problem in Commands().get_problems():
# Create a session for each problem and make it importable
_commands = Session(_problem)
_module = imp.new_module(_problem)
_module.__dict__['commands'] = _commands
sys.modules['featurefactory.problems.' + _problem] = _module
sys.modules['featurehub.problems.' + _problem] = _module
except ProgrammingError:
print("Competition not initialized properly. User commands "
"unavailable. Please contact the competition administrator.",
Expand Down
2 changes: 1 addition & 1 deletion src/featurefactory/tests/test_evaluator_response.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from featurefactory.evaluation import EvaluationResponse
from featurehub.evaluation import EvaluationResponse

def test_response_status_code_only():
all_status_codes = [
Expand Down
2 changes: 1 addition & 1 deletion src/featurefactory/tests/test_metrics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from featurefactory.modeling import Metric, MetricList
from featurehub.modeling import Metric, MetricList

def test_metric():
name = "Accuracy"
Expand Down
8 changes: 4 additions & 4 deletions src/featurefactory/tests/test_model.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import sys
import random
import featurefactory.util
import featurehub.util
import numpy as np
import pandas as pd
import sklearn.datasets

#from featurefactory.modeling.model_old import Model
from featurefactory.modeling.model import Model
from featurefactory.tests.util import EPSILON
#from featurehub.modeling.model_old import Model
from featurehub.modeling.model import Model
from featurehub.tests.util import EPSILON

# ------------------------------------------------------------------------------
# Create fake data
Expand Down
4 changes: 2 additions & 2 deletions src/featurefactory/tests/test_session.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from featurefactory.user.session import Session
from featurefactory.modeling import Metric, MetricList
from featurehub.user.session import Session
from featurehub.modeling import Metric, MetricList

def test_print_one_feature():
feature_description = "Age"
Expand Down
Loading

0 comments on commit bb30318

Please sign in to comment.