How to use the tsfresh.__version__ function in tsfresh

To help you get started, we’ve selected a few tsfresh examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github earthgecko / skyline / skyline / features_profile.py View on Github external
# Added log_context to report the context
    current_logger.info('%s :: features saved to %s' % (log_context, fname_out))
    current_logger.info('%s :: transposed features saved to %s' % (
        log_context, t_fname_out))
    total_calc_time = '%.6f' % (end - start)
    calc_time = '%.6f' % (feature_extraction_time)
    current_logger.info('%s :: total feature profile completed in %s seconds' % (
        log_context, str(total_calc_time)))

    # Create a features profile details file
    try:
        # @modified 20170108 - Feature #1842: Ionosphere - Graphite now graphs
        # Added the ts_full_duration here as it was not added here on the 20170104
        # when it was added the webapp and ionosphere
        data = '[%s, \'%s\', %s, %s, %s, %s]' % (
            str(int(time.time())), str(tsfresh_version), str(calc_time),
            str(features_count), str(features_sum), str(ts_full_duration))
        write_data_to_file(current_skyline_app, features_profile_details_file, 'w', data)
    except:
        trace = traceback.format_exc()
        current_logger.error('%s' % trace)
        # @modified 20190413 - Bug #2934: Ionosphere - no mirage.redis.24h.json file
        # Added log_context to report the context
        fail_msg = 'error :: %s :: failed to write %s' % (log_context, features_profile_details_file)
        current_logger.error('%s' % fail_msg)

    del df_sum

    if os.path.isfile(ts_csv):
        os.remove(ts_csv)
        # @modified 20190413 - Bug #2934: Ionosphere - no mirage.redis.24h.json file
        # Added log_context to report the context
github earthgecko / skyline / skyline / ionosphere / ionosphere.py View on Github external
logger.error('error :: failed to get ionosphere_matched_table meta for %s' % base_name)

                    try:
                        connection = engine.connect()
                        # @modified 20170107 - Feature #1852: Ionosphere - features_profile matched graphite graphs
                        #                      Feature #1844: ionosphere_matched DB table
                        # Added all_calc_features_sum, all_calc_features_count,
                        # sum_calc_values, common_features_count, tsfresh_version
                        ins = ionosphere_matched_table.insert().values(
                            fp_id=int(fp_id),
                            metric_timestamp=int(metric_timestamp),
                            all_calc_features_sum=float(all_calc_features_sum),
                            all_calc_features_count=len(all_calc_features_sum_list),
                            sum_common_values=float(sum_calc_values),
                            common_features_count=int(relevant_calc_feature_values_count),
                            tsfresh_version=str(tsfresh_version))
                        result = connection.execute(ins)
                        connection.close()
                        new_matched_id = result.inserted_primary_key[0]
                        logger.info('new ionosphere_matched id: %s' % str(new_matched_id))
                    except:
                        logger.error(traceback.format_exc())
                        logger.error(
                            'error :: could not update ionosphere_matched for %s with with timestamp %s' % (
                                str(fp_id), str(metric_timestamp)))

                    # @added 20170331 - Task #1988: Review - Ionosphere layers - always show layers
                    #                   Feature #1960: ionosphere_layers
                    # Added mirror functionality of the layers_id_matched_file
                    # for feature profile matches too as it has proved useful
                    # in the frontend with regards to training data sets being
                    # matched by layers and can do the same for in the frontend
github earthgecko / skyline / skyline / ionosphere_functions.py View on Github external
except:
            trace = traceback.format_exc()
            current_logger.error(traceback.format_exc())
            current_logger.error('error :: create_features_profile :: failed to created_fp_ts_graph for %s fp id %s' % (base_name, str(new_fp_id)))

    del validated_timeseries
    del insert_statement

    # Create a created features profile file
    try:
        # data = '[%s, %s, ]' % (new_fp_id, str(int(time.time())))
        # write_data_to_file(skyline_app, features_profile_created_file, 'w', data)
        # @modified 20170115 -  Feature #1854: Ionosphere learn - generations
        # Added parent_id and generation
        data = '[%s, %s, \'%s\', %s, %s, %s, %s, %s, %s]' % (
            new_fp_id, str(int(time.time())), str(tsfresh_version),
            str(calculated_time), str(fcount), str(fsum), str(ts_full_duration),
            str(fp_parent_id), str(fp_generation))
        write_data_to_file(current_skyline_app, features_profile_created_file, 'w', data)
        del data
    except:
        trace = traceback.format_exc()
        current_logger.error('%s' % trace)
        fail_msg = 'error :: create_features_profile :: failed to write fp.created file'
        current_logger.error('%s' % fail_msg)

    # Set ionosphere_enabled for the metric
    try:
        # update_statement = 'UPDATE metrics SET ionosphere_enabled=1 WHERE id=%s' % str(metrics_id)
        connection = engine.connect()
        # result = connection.execute('UPDATE metrics SET ionosphere_enabled=1 WHERE id=%s' % str(metrics_id))
        # connection.execute(ts_metric_table.insert(), insert_statement)
github earthgecko / skyline / skyline / ionosphere_functions.py View on Github external
# Added ionosphere_echo echo_fp
        # @modified 20190327 - Feature #2484: FULL_DURATION feature profiles
        # Handle ionosphere_echo change in timestamp to the next second and a mismatch
        # of 1 second between the features profile directory timestamp and the DB
        # created_timestamp
        # @modified 20190919 - Feature #3230: users DB table
        #                      Ideas #2476: Label and relate anomalies
        #                      Feature #2516: Add label to features profile
        # Added user_id and label
        if context == 'ionosphere_echo' or context == 'ionosphere_echo_check':
            ts_for_db = int(requested_timestamp)
            db_created_timestamp = datetime.utcfromtimestamp(ts_for_db).strftime('%Y-%m-%d %H:%M:%S')
            ins = ionosphere_table.insert().values(
                metric_id=int(metrics_id), full_duration=int(ts_full_duration),
                anomaly_timestamp=int(use_anomaly_timestamp),
                enabled=1, tsfresh_version=str(tsfresh_version),
                calc_time=calculated_time, features_count=fcount,
                features_sum=fsum, parent_id=fp_parent_id,
                generation=fp_generation, validated=fp_validated,
                echo_fp=echo_fp_value, created_timestamp=db_created_timestamp,
                user_id=user_id, label=label)
        else:
            ins = ionosphere_table.insert().values(
                metric_id=int(metrics_id), full_duration=int(ts_full_duration),
                anomaly_timestamp=int(use_anomaly_timestamp),
                enabled=1, tsfresh_version=str(tsfresh_version),
                calc_time=calculated_time, features_count=fcount,
                features_sum=fsum, parent_id=fp_parent_id,
                generation=fp_generation, validated=fp_validated,
                echo_fp=echo_fp_value, user_id=user_id, label=label)
        result = connection.execute(ins)
        connection.close()