Skip to main content

safer package

Project description

SAFER

This guide provides SAFER model module

Baseline

  • Baseline
    • data_processing_m1
      • crf_data.py
      • location_data.py
      • sensor_data.py
    • data_processing_m2
      • crf_data.ppy
      • location_data.py
      • sensor_data.py
    • model1
      • dataloader.py
      • model.py
      • predictor.py
    • model2
      • dataloader.py
      • model.py
      • preictor.py
    • setup.py
    • README.md

How To Use

Start pip install

  • data processing

    1. location

      You can load location data from preprocess it as follows:

    
      from location_processor import LocationProcessor
    
      file_path = ''
      processed_location_data = LocationProcessor.load_data_from_csv(file_path)
    
      location_dict = {
          (37.7749, -122.4194): 'ward',
          (34.0522, -118.2437): 'hallway',
          (40.7128, -74.0060): 'other',
      }
    
      labeled_location_data = LocationProcessor.assign_location_labels(processed_data, location_dict)
    
    
      
    1. sensor

      you can load sensor data from preprocess it as follows :

      
       from sensor_processor import SensorDataProcessor
      
       file_path = ''
       sensing_data = SensorDataProcessor.load_sensing_data(file_path)
       sensing_data = SensorDataProcessor.process_sensing_data(sensing_data)
       sensing_data = SensorDataProcessor.aggregate_sensing_data(sensing_data)
       sensing_data = SensorDataProcessor.reorganize_column_names(sensing_data)
       
    2. patient data (2 type of data)

      you can load patient data from preprocess it as follows :

      
       from crf_data import DataProcessor
       status_file_path = ''
       trait_fiile_path = ''
          
       processor = DataProcessor()
      
       processor.load_data(
           location_file=labeled_location_data,
           sensor_file=sensing_data,
           crf_file= status_file_path ,
           trait_file= trait_fiile_path
       )
      
       processor.merge_location_and_sensor()
       processor.process_crf_data()
       processor.merge_trait_data()
      
      
      
       suicide_flags = [
           ('patient_key', pd.to_datetime('2023-12-02 00:00:00')),
           .
           .
       ]
      
      
      
       final_data = processor.clean_and_set_suicide_flag(suicide_flags)
       final_data = filter_data_for_self_harm_and_random(final_data, suicide_flags)
      
       
  • model

    you can predict m1 from preprocess it as follows :

    • m1
    
          from model1.model import TemporalFusionTransformer
          from model1.predictor import PredictionHandler
    
          data_paths = ['']
          predictor = PredictionHandler(data_paths, batch_size=16, device='cpu')
          predictions = predictor.predict()
    
       
    • m2
    
          from model2.predictor import Predictor
          import torch
          from model2.model import CNNGRUClassificationModel
    
          data_path = ''  
    
          device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
    
          predictor = Predictor(device=device)
    
          data_loader = predictor.preprocess_data(data_path)
    
          predictions = predictor.predict(data_loader)
    
          print(predictions)
    
      

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gsecure-0.0.5.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gsecure-0.0.5-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file gsecure-0.0.5.tar.gz.

File metadata

  • Download URL: gsecure-0.0.5.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for gsecure-0.0.5.tar.gz
Algorithm Hash digest
SHA256 0d8a7b53f7c14fb4a987a65a572bfa09577554ebeb79d849d1ccff1283b4ec34
MD5 106b824ebd52086306eeebff9fdf3362
BLAKE2b-256 edbbba9c19c37d4d748980995d6bccac62512fd6e5041dbaed98786adf85ac18

See more details on using hashes here.

File details

Details for the file gsecure-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: gsecure-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 26.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for gsecure-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4f90d64e5ec4ef17afe3351c80d3993557fed2e2e9ed5bddc77e2c9d2569cc98
MD5 bcd2a1fa181a119f29e7e751443c4929
BLAKE2b-256 24e2ff79236f5f97102a792c8f18728a0800bbd5b701e8a62d0d92272b1dbdc0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page