Homework Submission Guidelines
Relevant source files
The following files were used as context for generating this wiki page:
The homework submission structure within the BME533 project is designed around modular Python scripts that perform statistical analysis on external datasets. These guidelines focus on the systematic processing of biological or physiological data, specifically through the calculation of central tendency, dispersion, and variation metrics.
The project structure organizes assignments into directories (e.g., hw1/), containing both the logic scripts and the raw data files in text format. This architecture ensures that data remains decoupled from the analytical logic, allowing for reusable processing functions.
Sources: hw1/p1.py, hw1/CHOLESTEROL.txt, hw1/WEIGHT.txt
Data Processing Architecture
The system utilizes a functional approach to ingest and analyze data. The primary workflow involves opening a file, sanitizing the input by removing whitespace, and converting valid entries into floating-point numbers for mathematical computation.
File Ingestion Logic
The data ingestion process is managed by the open_file function, which populates a global list named data. It includes error handling to skip non-numeric values that might be present in the source text files.
def open_file(file_name):
with open(file_name, 'r') as file:
for line in file:
line = line.strip()
if line:
try:
data.append(float(line))
except ValueError:
print(f"Skipping non-numeric value: {line}")
Sources: hw1/p1.py:6-16
Statistical Pipeline
The following diagram illustrates the sequence of operations when a file is processed through the compute_file execution flow.
This flowchart describes the logic used to transform raw text data into statistical insights.
Sources: hw1/p1.py:5-62
Statistical Calculations and Metrics
The framework calculates eight primary statistical values to describe the dataset. It leverages numpy for efficient array operations and the statistics module for specific metrics like mode.
Computed Metrics Summary
| Metric | Method/Formula | Implementation Library |
|---|---|---|
| Mean | Arithmetic average | numpy.mean |
| Median | Middle value | numpy.median |
| Mode | Most frequent value | statistics.mode |
| Range | Peak-to-peak (max - min) | numpy.ptp |
| Std Dev | Standard Deviation | numpy.std |
| Variance | Average squared deviation | numpy.var |
| CV1 | 3 * (Mean - Median) / Std Dev | Custom Formula |
| CV2 | Sum((x-Mean)^3) / (N * Std^3) | Custom List Comp |
Sources: hw1/p1.py:24-60
Coefficient of Variation (CV) Implementation
The project implements two distinct coefficients of variation to assess data distribution characteristics.
- First Coefficient: Measures skewness relative to the standard deviation.
- Second Coefficient: Uses the third moment (cubed deviations) to calculate skewness.
# 1st Coefficient of Variation
cv1 = 3*(mean - median) / std
# 2nd Coefficient of Variation
cv2 = sum([(x - mean) ** 3 for x in data]) / (len(data) * std ** 3)
Sources: hw1/p1.py:54-58
Data Formats
Data is stored in plain .txt files, one value per line. The scripts are specifically tested against biological measurements such as Cholesterol levels and Weight.
- CHOLESTEROL.txt: Contains integer values ranging from 74 to 282.
- WEIGHT.txt: Contains integer values ranging from 49 to 71.
Sources: hw1/CHOLESTEROL.txt:1-29, hw1/WEIGHT.txt:1-12
Execution Sequence
The script execution follows a synchronous pattern where the file name is passed to a high-level wrapper function that coordinates data loading and mathematical processing.
The sequence diagram demonstrates the interaction between the main script, the filesystem, and the mathematical libraries.
Sources: hw1/p1.py:18-62
The homework submission system provides a standardized method for basic biostatistical analysis, ensuring consistency across different datasets through a shared processing pipeline.