Example #1
0
def show_plot_by_company(company):
    """
    Diplays time series plot containing the tweets about given company.
    """
    plotter = DataPlotter()
    graph = plotter.get_graph(company=company)
    return render_template("plot.html", graph=graph)
Example #2
0
def show_plot_by_area(area):
    """
    Displays time series plot containing the tweets of given area.
    """
    plotter = DataPlotter()
    if area.lower() == "global":
        graph = plotter.get_graph()
    else:
        graph = plotter.get_graph(area=area)
    return render_template("plot.html", graph=graph)
Example #3
0
def plot_overall_rating():

    # reviews = extractor.pre_process_reviews()
    reviews = ETLUtils.load_json_file('/Users/fpena/tmp/filtered_reviews.json')
    data_frame = DataFrame(reviews)

    print(data_frame)

    DataPlotter.plot_data(data_frame, 'overall_rating', plot_type='bar', title='Overall Rating')
    # DataPlotter.plot_data(data_frame, 'cleanliness_rating', plot_type='bar', title='Cleanliness Rating')
    # DataPlotter.plot_data(data_frame, 'location_rating', plot_type='bar', title='Location Rating')
    # DataPlotter.plot_data(data_frame, 'rooms_rating', plot_type='bar', title='Rooms Rating')
    # DataPlotter.plot_data(data_frame, 'service_rating', plot_type='bar', title='Service Rating')
    # DataPlotter.plot_data(data_frame, 'value_rating', plot_type='bar', title='Value Rating')
    plt.show()
Example #4
0
def plot_overall_rating():

    # reviews = extractor.pre_process_reviews()
    reviews = ETLUtils.load_json_file('/Users/fpena/tmp/filtered_reviews.json')
    data_frame = DataFrame(reviews)

    print(data_frame)

    DataPlotter.plot_data(data_frame,
                          'overall_rating',
                          plot_type='bar',
                          title='Overall Rating')
    # DataPlotter.plot_data(data_frame, 'cleanliness_rating', plot_type='bar', title='Cleanliness Rating')
    # DataPlotter.plot_data(data_frame, 'location_rating', plot_type='bar', title='Location Rating')
    # DataPlotter.plot_data(data_frame, 'rooms_rating', plot_type='bar', title='Rooms Rating')
    # DataPlotter.plot_data(data_frame, 'service_rating', plot_type='bar', title='Service Rating')
    # DataPlotter.plot_data(data_frame, 'value_rating', plot_type='bar', title='Value Rating')
    plt.show()
Example #5
0
    def __init__(self, app, serial):
        super(Window, self).__init__()
        self.setWindowTitle('Tic Disorder Detection')
        self.main_layout = QVBoxLayout()
        self.window = QtGui.QWidget(self)
        self.button_layout = QVBoxLayout()
        self.window.setLayout(self.button_layout)

        self.gesture_layout = QHBoxLayout()
        self.gesture_container = QtGui.QWidget(self)
        self.gesture_container.setLayout(self.gesture_layout)

        self.data_plotters = [DataPlotter() for _ in range(4)]
        for plotter in self.data_plotters:
            self.gesture_layout.addWidget(plotter)

        self.serial_plot = SerialPlot(app, 127, serial)
        self.main_layout.addWidget(self.serial_plot)
        self.main_layout.addWidget(self.window)
        self.main_layout.addWidget(self.gesture_container)

        self.setLayout(self.main_layout)
        self.show()
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('-s', '--select', action='store_true')
    parser.add_argument('-t', '--test', action='store_true')
    parser.add_argument('-c', '--count', action='store_true')
    parser.add_argument('-m', '--merge', '--combine', action='store_true')
    parser.add_argument('-e', '--extract', action='store_true')
    parser.add_argument('-d', '--debuginput', action='store_true')
    parser.add_argument('-r', '--review', action='store_true')
    parser.add_argument('--replace-debug', action='store_true')
    parser.add_argument('-p', '--plot-data', action='store_true')
    parser.add_argument('--base-data', action='store_true')
    parser.add_argument('--features', default='original')
    parser.add_argument('-f', '--homology-filter', action='store_true')
    parser.add_argument('-y', '--classify', action='store_true')
    parser.add_argument('--grid-search', action='store_true')
    parser.add_argument('--plot', action='store_true')
    parser.add_argument('--fit', action='store_true')
    parser.add_argument('--count-total-number-of-genes', action='store_true')

    args = parser.parse_args()

    if args.select:
        if args.test:
            selector = Selector("config/Test/selection_config.json")
        else:
            selector = Selector("config/selection_config.json")
        selector.select()
        selector.selected_to_folder()

    if args.count:
        if args.test:
            counter = Counter("config/Test/counter_config.json")
        else:
            counter = Counter("config/counter_config.json")
        counter.count_all_viruses()

    if args.merge:
        if args.test:
            combiner = Combiner("config/Test/combiner_config.json")
        else:
            combiner = Combiner("config/combiner_config.json")
        combiner.combine_all_viruses()

    if args.debuginput:
        debug_input_collector = DebugInfoCollector("config/debug_info_collector_config.json")
        if args.replace_debug:
            debug_input_collector.collect(True)
        else:
            debug_input_collector.collect()

    if args.review:
        import Review
        Review.run()

    if args.plot_data:
        data_plotter = DataPlotter("config/data_plotter_config.json")
        data_plotter.plot()

    if args.base_data:
        base_data = BaseData("config/base_data_config.json")
        base_data.create_data()

    if args.homology_filter:
        homology_filter = HomologyFilter('config/homology_filter.json')
        homology_filter.filter()

    if args.extract:
        feature_extractor = FeatureExtraction("config/feature_extraction_config.json")
        feature_extractor.extract(args.features)

    if args.count_total_number_of_genes:
        combiner = Combiner("config/combiner_config.json")
        combiner.print_number_of_genes()

    if args.classify:
        if args.grid_search:
            MLgrid = [
                {
                    "booster": ["gblinear"],
                    # "lambda": [0, 0.0001, 0.001],
                    "lambda": [0],
                    # "updater": ["shotgun", "coord_descent"],
                    "updater": ["coord_descent", "shotgun"],
                    # "feature_selector": ["cyclic", "shuffle", "random", "greedy", "thrifty"]
                    "feature_selector": ["shuffle"]
                }
                # {
                #     "booster": ["gbtree"],
                #     # "max_depth": range(3, 10, 2),
                #     # "min_child_weight": range(1, 6, 2)
                # }
            ]
            _1vsAgrid = [
                {
                    "estimator__booster": ["gblinear"],
                    "estimator__lambda": [0.1],
                    "estimator__updater": ["coord_descent"],
                    "estimator__feature_selector": ["shuffle"]
                },
                # {
                #     "estimator__booster": ["gbtree"],
                #     "estimator__max_depth": range(3, 10, 2),
                #     "estimator__min_child_weight": range(1, 6, 2)
                # }

            ]
            RRgrid = [
                {
                    "estimator__booster": ["gblinear"],
                    "estimator__lambda": [0.1],
                    "estimator__updater": ["coord_descent"],
                    "estimator__feature_selector": ["shuffle"]
                },
                # {
                #     "estimator__booster": ["gbtree"]
                # #     "estimator__max_depth": range(3, 10, 2),
                # #     "estimator__min_child_weight": range(1, 6, 2)
                # }

            ]
            classification = Classification('config/classification_config.json', args.features)
            classification.grid_search('ML', 'XGBoost', MLgrid, 200, 'no-pca')
        else:
            if args.fit:
                classification = Classification('config/classification_config.json', args.features)
                classification.fit_all()

            if args.plot:
                cp = ClassificationPlotter('config/classification_config.json', args.features)
                cp.plot_all()