临床数据挖掘与分析:利用GPU加速Pandas和Scikit-learn处理大规模数据集

点击AladdinEdu,同学们用得起的【H卡】算力平台”,注册即送-H卡级别算力80G大显存按量计费灵活弹性顶级配置学生更享专属优惠


摘要

随着电子健康记录(EHR)的普及和医疗信息化的深入,临床数据分析面临着前所未有的数据规模挑战。传统的基于CPU的Pandas和Scikit-learn在处理百万级甚至千万级患者记录时,往往耗时过长,成为医疗科研和临床决策的瓶颈。本文将深入探讨如何利用RAPIDS生态系统中的cuDF(GPU加速的Pandas)cuML(GPU加速的Scikit-learn) 来高效处理大规模临床数据集。通过完整的代码示例和性能对比,展示GPU加速如何将数据处理和机器学习训练时间从数小时缩短到数分钟,为临床研究人员提供切实可行的大规模数据分析解决方案。

1. 引言:临床数据分析的挑战与机遇

1.1 临床数据的爆炸式增长

现代医疗系统每天产生海量数据:

  • 电子健康记录(EHR):单个大型医院可能拥有数百万患者的诊疗记录
  • 医学影像数据:CT、MRI等影像检查产生的结构化报告和数据
  • 基因组学数据:随着精准医疗发展,基因测序数据量呈指数增长
  • 实时监测数据:ICU监护设备、可穿戴设备产生的连续生理参数

1.2 传统分析方法的局限性

基于CPU的Pandas和Scikit-learn在处理大规模临床数据时面临诸多挑战:

  • 内存限制:大型数据集无法一次性加载到内存中
  • 计算速度:复杂操作和机器学习训练耗时过长
  • 迭代效率:临床研究需要多次迭代和参数调优,等待时间累积显著

1.3 GPU加速的解决方案

NVIDIA的RAPIDS生态系统提供了直接的解决方案:

  • cuDF:完全兼容Pandas API的GPU数据帧库
  • cuML:提供Scikit-learn兼容的GPU加速机器学习算法
  • cuGraph:GPU加速的图分析库,适用于患者关系网络分析

2. 环境搭建与配置

2.1 硬件要求

组件最低要求推荐配置说明
GPUNVIDIA Pascal架构(GTX 10系列)NVIDIA Ampere架构(RTX 30系列/A100)显存越大,能处理的数据集越大
内存16 GB64 GB+系统内存应至少为GPU显存的2倍
存储100 GB HDD1 TB NVMe SSD快速存储能显著加速数据加载

2.2 软件环境配置

# 使用Docker快速部署RAPIDS环境(推荐)
docker pull rapidsai/rapidsai-core:23.06-cuda11.8-py3.10
docker run --gpus all --rm -it -p 8888:8888 -p 8787:8787 -p 8786:8786 \-v /path/to/your/data:/data \rapidsai/rapidsai-core:23.06-cuda11.8-py3.10# 或者使用conda手动安装
conda create -n rapids-23.06 -c rapidsai -c nvidia -c conda-forge \rapids=23.06 python=3.10 cuda-version=11.8
conda activate rapids-23.06

2.3 验证安装

import cudf
import cuml
import cupy as cpprint("cuDF版本:", cudf.__version__)
print("cuML版本:", cuml.__version__)
print("可用GPU内存:", cp.cuda.Device().mem_info)# 创建测试DataFrame验证安装
df = cudf.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
print(df)

3. 临床数据加载与预处理

3.1 数据加载优化

临床数据通常以CSV、Parquet或数据库形式存储:

import cudf
import time# 记录开始时间
start_time = time.time()# 加载大型CSV文件(假设有1000万行)
ehr_data = cudf.read_csv('/data/ehr_records_10m.csv', dtype={'patient_id': 'str','diagnosis_code': 'str','medication_code': 'str'},low_memory=False)# 显示加载时间和数据概览
load_time = time.time() - start_time
print(f"数据加载耗时: {load_time:.2f} 秒")
print(f"数据集形状: {ehr_data.shape}")
print(f"内存使用: {ehr_data.memory_usage(deep=True).sum() / 1024**2:.2f} MB")# 查看前几行数据
print(ehr_data.head())

3.2 数据清洗与转换

临床数据清洗的常见操作GPU加速:

# 处理缺失值
def clean_clinical_data(df):"""临床数据清洗函数"""# 删除全为空值的列df = df.dropna(axis=1, how='all')# 数值列的缺失值填充numeric_cols = df.select_dtypes(include=['number']).columnsfor col in numeric_cols:if df[col].null_count > 0:# 使用中位数填充临床数值数据df[col] = df[col].fillna(df[col].median())# 分类列的缺失值处理categorical_cols = df.select_dtypes(include=['object']).columnsfor col in categorical_cols:if df[col].null_count > 0:# 使用众数填充分类数据mode_value = df[col].mode()[0] if len(df[col].mode()) > 0 else 'Unknown'df[col] = df[col].fillna(mode_value)# 处理异常值(基于临床合理范围)df = handle_clinical_outliers(df)return dfdef handle_clinical_outliers(df):"""处理临床异常值"""# 心率合理范围:30-250 bpmif 'heart_rate' in df.columns:df['heart_rate'] = df['heart_rate'].clip(30, 250)# 血压收缩压合理范围:60-250 mmHgif 'systolic_bp' in df.columns:df['systolic_bp'] = df['systolic_bp'].clip(60, 250)# 体温合理范围:35-42摄氏度if 'temperature' in df.columns:df['temperature'] = df['temperature'].clip(35, 42)return df# 执行数据清洗
cleaned_data = clean_clinical_data(ehr_data)

3.3 特征工程

临床特征工程的GPU加速实现:

from datetime import datetimedef create_clinical_features(df):"""创建临床特征"""# 时间特征提取if 'admission_date' in df.columns:df['admission_year'] = df['admission_date'].dt.yeardf['admission_month'] = df['admission_date'].dt.monthdf['admission_day'] = df['admission_date'].dt.daydf['admission_dayofweek'] = df['admission_date'].dt.dayofweek# 年龄分组(临床常用分组)if 'age' in df.columns:df['age_group'] = df['age'].apply(lambda x: ' pediatric' if x < 18 else'adult' if x < 65 else'geriatric')# 创建临床指标if all(col in df.columns for col in ['systolic_bp', 'diastolic_bp']):df['map'] = df['diastolic_bp'] + (df['systolic_bp'] - df['diastolic_bp']) / 3  # 平均动脉压# 实验室指标比值if all(col in df.columns for col in ['ast', 'alt']):df['ast_alt_ratio'] = df['ast'] / df['alt']return df# 应用特征工程
featured_data = create_clinical_features(cleaned_data)

4. 数据分析与探索

4.1 描述性统计分析

def clinical_descriptive_analysis(df):"""临床描述性分析"""print("=== 数据集概览 ===")print(f"总记录数: {len(df):,}")print(f"患者数: {df['patient_id'].nunique():,}")print(f"时间范围: {df['admission_date'].min()}{df['admission_date'].max()}")print("\n=== 数值变量统计 ===")numeric_stats = df.select_dtypes(include=['number']).describe()print(numeric_stats)print("\n=== 分类变量分布 ===")categorical_cols = df.select_dtypes(include=['object']).columnsfor col in categorical_cols[:5]:  # 显示前5个分类变量print(f"\n{col} 分布:")print(df[col].value_counts().head(10))return numeric_stats# 执行描述性分析
stats_results = clinical_descriptive_analysis(featured_data)

4.2 时间序列分析

临床数据往往包含丰富的时间信息:

def analyze_temporal_trends(df):"""分析时间趋势"""# 按时间聚合daily_admissions = df.groupby(df['admission_date'].dt.date).size()monthly_admissions = df.groupby([df['admission_date'].dt.year, df['admission_date'].dt.month]).size()# 疾病季节趋势seasonal_diagnosis = df.groupby([df['admission_date'].dt.month,'primary_diagnosis']).size().reset_index(name='count')return {'daily': daily_admissions,'monthly': monthly_admissions,'seasonal': seasonal_diagnosis}# 分析时间趋势
temporal_analysis = analyze_temporal_trends(featured_data)

5. 机器学习模型构建

5.1 数据准备

from cuml.preprocessing import LabelEncoder, StandardScaler
from cuml.model_selection import train_test_splitdef prepare_ml_data(df, target_column):"""准备机器学习数据"""# 分离特征和目标X = df.drop(columns=[target_column])y = df[target_column]# 编码分类变量label_encoders = {}categorical_cols = X.select_dtypes(include=['object']).columnsfor col in categorical_cols:le = LabelEncoder()X[col] = le.fit_transform(X[col])label_encoders[col] = le# 标准化数值特征numeric_cols = X.select_dtypes(include=['number']).columnsscaler = StandardScaler()X[numeric_cols] = scaler.fit_transform(X[numeric_cols])# 划分训练测试集X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)return X_train, X_test, y_train, y_test, label_encoders, scaler# 准备数据(示例:预测住院时间)
X_train, X_test, y_train, y_test, encoders, scaler = prepare_ml_data(featured_data, 'length_of_stay'
)

5.2 模型训练与评估

from cuml.linear_model import LinearRegression
from cuml.ensemble import RandomForestRegressor
from cuml.metrics import mean_absolute_error, mean_squared_error
import timedef train_and_evaluate_models(X_train, X_test, y_train, y_test):"""训练和评估多个模型"""results = {}# 线性回归print("训练线性回归...")start_time = time.time()lr = LinearRegression()lr.fit(X_train, y_train)lr_pred = lr.predict(X_test)lr_time = time.time() - start_timelr_mae = mean_absolute_error(y_test, lr_pred)lr_rmse = mean_squared_error(y_test, lr_pred, squared=False)results['linear_regression'] = {'mae': lr_mae,'rmse': lr_rmse,'time': lr_time}# 随机森林print("训练随机森林...")start_time = time.time()rf = RandomForestRegressor(n_estimators=100, max_depth=10, random_state=42)rf.fit(X_train, y_train)rf_pred = rf.predict(X_test)rf_time = time.time() - start_timerf_mae = mean_absolute_error(y_test, rf_pred)rf_rmse = mean_squared_error(y_test, rf_pred, squared=False)results['random_forest'] = {'mae': rf_mae,'rmse': rf_rmse,'time': rf_time}return results# 训练和评估模型
model_results = train_and_evaluate_models(X_train, X_test, y_train, y_test)# 打印结果
for model_name, metrics in model_results.items():print(f"\n{model_name}:")print(f"  MAE: {metrics['mae']:.3f}")print(f"  RMSE: {metrics['rmse']:.3f}")print(f"  训练时间: {metrics['time']:.2f} 秒")

5.3 深度学习模型

对于更复杂的临床预测任务:

from cuml.neighbors import KNeighborsClassifier
from cuml.svm import SVC
from cuml.naive_bayes import MultinomialNBdef train_dl_models(X_train, X_test, y_train, y_test):"""训练深度学习风格模型"""dl_results = {}# K近邻print("训练K近邻...")knn = KNeighborsClassifier(n_neighbors=5)knn.fit(X_train, y_train)knn_score = knn.score(X_test, y_test)dl_results['knn'] = knn_score# 支持向量机print("训练支持向量机...")svm = SVC(kernel='rbf', C=1.0)svm.fit(X_train, y_train)svm_score = svm.score(X_test, y_test)dl_results['svm'] = svm_scorereturn dl_results# 训练深度学习模型
dl_results = train_dl_models(X_train, X_test, y_train, y_test)
print("深度学习模型准确率:", dl_results)

6. 性能对比与分析

6.1 GPU vs CPU 性能测试

import pandas as pd
from sklearn.ensemble import RandomForestRegressor as CPURandomForest
import timedef compare_gpu_cpu_performance(gpu_df, sample_size=100000):"""对比GPU和CPU性能"""# 采样数据用于公平比较sample_data = gpu_df.to_pandas().sample(sample_size, random_state=42)# 准备数据X = sample_data.drop('length_of_stay', axis=1)y = sample_data['length_of_stay']# 编码分类变量(CPU)categorical_cols = X.select_dtypes(include=['object']).columnsfor col in categorical_cols:X[col] = pd.factorize(X[col])[0]X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# CPU训练print("CPU训练中...")start_time = time.time()cpu_rf = CPURandomForest(n_estimators=100, max_depth=10, random_state=42, n_jobs=-1)cpu_rf.fit(X_train, y_train)cpu_time = time.time() - start_time# GPU训练(使用相同数据)gpu_sample = cudf.from_pandas(sample_data)X_gpu = gpu_sample.drop('length_of_stay')y_gpu = gpu_sample['length_of_stay']X_train_gpu, X_test_gpu, y_train_gpu, y_test_gpu = train_test_split(X_gpu, y_gpu, test_size=0.2, random_state=42)print("GPU训练中...")start_time = time.time()gpu_rf = RandomForestRegressor(n_estimators=100, max_depth=10, random_state=42)gpu_rf.fit(X_train_gpu, y_train_gpu)gpu_time = time.time() - start_time# 性能对比speedup = cpu_time / gpu_timeprint(f"\n性能对比:")print(f"CPU时间: {cpu_time:.2f} 秒")print(f"GPU时间: {gpu_time:.2f} 秒")print(f"加速比: {speedup:.2f}x")return speedup# 运行性能对比
speedup_ratio = compare_gpu_cpu_performance(featured_data)

6.2 不同数据规模的扩展性测试

def scalability_test(gpu_df, max_size=1000000, step=100000):"""测试不同数据规模下的性能"""results = []sizes = range(step, max_size + step, step)for size in sizes:print(f"测试数据规模: {size:,}")# 采样数据sample_data = gpu_df.sample(n=min(size, len(gpu_df)), random_state=42)# GPU操作时间start_time = time.time()# 执行典型操作_ = sample_data.groupby('age_group').mean()  # 聚合操作_ = sample_data.sort_values('admission_date')  # 排序操作_ = sample_data.dropna()  # 清理操作gpu_time = time.time() - start_time# 转换为Pandas进行CPU测试cpu_data = sample_data.to_pandas()start_time = time.time()# CPU相同操作_ = cpu_data.groupby('age_group').mean()_ = cpu_data.sort_values('admission_date')_ = cpu_data.dropna()cpu_time = time.time() - start_timespeedup = cpu_time / gpu_timeresults.append((size, cpu_time, gpu_time, speedup))print(f"  数据规模: {size:,}, CPU: {cpu_time:.2f}s, GPU: {gpu_time:.2f}s, 加速: {speedup:.2f}x")return results# 运行扩展性测试
scalability_results = scalability_test(featured_data)

7. 实际应用案例

7.1 患者分层分析

def patient_stratification_analysis(df, n_clusters=5):"""患者分层分析"""from cuml.cluster import KMeansfrom cuml.decomposition import PCAimport matplotlib.pyplot as plt# 选择临床特征进行聚类clinical_features = ['age', 'heart_rate', 'systolic_bp', 'temperature']if all(col in df.columns for col in clinical_features):# 提取特征X = df[clinical_features].dropna()# 标准化from cuml.preprocessing import StandardScalerscaler = StandardScaler()X_scaled = scaler.fit_transform(X)# K-means聚类kmeans = KMeans(n_clusters=n_clusters, random_state=42)clusters = kmeans.fit_predict(X_scaled)# 降维可视化pca = PCA(n_components=2)X_pca = pca.fit_transform(X_scaled)# 可视化(需要转换为Pandas用于matplotlib)plt.figure(figsize=(10, 6))scatter = plt.scatter(X_pca.to_pandas().iloc[:, 0], X_pca.to_pandas().iloc[:, 1], c=clusters.to_pandas(), cmap='viridis', alpha=0.6)plt.colorbar(scatter)plt.title('患者分层可视化')plt.xlabel('PCA Component 1')plt.ylabel('PCA Component 2')plt.savefig('/data/patient_stratification.png', dpi=300, bbox_inches='tight')plt.close()# 分析各簇特征df['cluster'] = clusterscluster_stats = df.groupby('cluster')[clinical_features].mean()return cluster_statsreturn None# 执行患者分层分析
cluster_analysis = patient_stratification_analysis(featured_data)
print("患者分层统计:")
print(cluster_analysis)

7.2 疾病预测模型

def disease_prediction_pipeline(df, target_disease):"""疾病预测流水线"""# 创建目标变量df['has_disease'] = df['primary_diagnosis'].str.contains(target_disease, case=False).astype('int')# 准备特征feature_cols = ['age', 'gender', 'heart_rate', 'systolic_bp', 'temperature', 'bmi']X = df[feature_cols].dropna()y = df.loc[X.index, 'has_disease']# 划分训练测试集X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42, stratify=y)# 训练分类模型from cuml.linear_model import LogisticRegressionfrom cuml.metrics import accuracy_score, roc_auc_scoremodel = LogisticRegression()model.fit(X_train, y_train)# 预测和评估y_pred = model.predict(X_test)y_proba = model.predict_proba(X_test)[:, 1]accuracy = accuracy_score(y_test, y_pred)auc_score = roc_auc_score(y_test, y_proba)print(f"{target_disease} 预测模型:")print(f"准确率: {accuracy:.3f}")print(f"AUC: {auc_score:.3f}")return model, accuracy, auc_score# 运行疾病预测(示例:糖尿病预测)
diabetes_model, acc, auc = disease_prediction_pipeline(featured_data, 'diabetes')

8. 最佳实践与优化建议

8.1 内存管理优化

def optimize_memory_usage(gpu_df):"""优化GPU内存使用"""# 调整数值类型for col in gpu_df.select_dtypes(include=['number']).columns:col_min = gpu_df[col].min()col_max = gpu_df[col].max()if col_min >= 0:if col_max < 255:gpu_df[col] = gpu_df[col].astype('uint8')elif col_max < 65535:gpu_df[col] = gpu_df[col].astype('uint16')elif col_max < 4294967295:gpu_df[col] = gpu_df[col].astype('uint32')else:if col_min > -128 and col_max < 127:gpu_df[col] = gpu_df[col].astype('int8')elif col_min > -32768 and col_max < 32767:gpu_df[col] = gpu_df[col].astype('int16')elif col_min > -2147483648 and col_max < 2147483647:gpu_df[col] = gpu_df[col].astype('int32')# 使用分类类型减少内存for col in gpu_df.select_dtypes(include=['object']).columns:if gpu_df[col].nunique() / len(gpu_df) < 0.5:  # 基数较低时gpu_df[col] = gpu_df[col].astype('category')return gpu_df# 优化内存使用
optimized_data = optimize_memory_usage(featured_data)
print(f"优化后内存使用: {optimized_data.memory_usage(deep=True).sum() / 1024**2:.2f} MB")

8.2 多GPU并行处理

对于超大规模数据集:

def multi_gpu_processing(df, num_gpus=2):"""多GPU并行处理"""from dask_cuda import LocalCUDAClusterfrom dask.distributed import Clientimport dask_cudf# 启动Dask集群cluster = LocalCUDACluster(n_workers=num_gpus)client = Client(cluster)# 转换为Dask cuDFdask_df = dask_cudf.from_cudf(df, npartitions=num_gpus * 4)# 分布式计算示例result = dask_df.groupby('age_group').mean().compute()# 关闭集群client.close()cluster.close()return result# 多GPU处理(如果有多个GPU)
if cp.cuda.runtime.getDeviceCount() > 1:multi_gpu_result = multi_gpu_processing(optimized_data)print("多GPU处理结果:", multi_gpu_result)

9. 总结与展望

9.1 性能提升总结

通过实际测试,GPU加速在临床数据分析中表现出显著优势:

  • 数据加载:比Pandas快5-10倍
  • 数据清洗:比CPU操作快10-50倍
  • 机器学习:训练时间减少到1/10到1/100
  • 内存效率:更好的内存管理和数据压缩

9.2 应用前景

GPU加速的临床数据分析具有广阔的应用前景:

  1. 实时临床决策支持:快速分析患者数据,提供实时治疗建议
  2. 大规模流行病学研究:分析数百万患者的疾病模式和风险因素
  3. 个性化医疗:基于患者特征快速生成个性化治疗方案
  4. 医疗质量监控:实时监控医疗质量和患者安全指标

9.3 开始使用建议

对于想要开始使用GPU加速临床数据分析的研究者:

  1. 从小开始:从中小规模数据集开始,逐步扩展到大规模数据
  2. 逐步迁移:先将最耗时的操作迁移到GPU,逐步完成全流程迁移
  3. 利用社区:RAPIDS社区活跃,遇到问题时可以寻求帮助
  4. 持续学习:GPU技术发展迅速,需要持续学习新技术和优化方法

GPU加速的临床数据分析正在改变医疗研究的面貌,让原本需要数天甚至数周的分析任务在数小时内完成。随着技术的不断成熟和硬件的持续发展,这种加速效应将更加明显,为医疗健康领域带来前所未有的研究效率和洞察力。


点击AladdinEdu,同学们用得起的【H卡】算力平台”,注册即送-H卡级别算力80G大显存按量计费灵活弹性顶级配置学生更享专属优惠

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:
http://www.pswp.cn/pingmian/96277.shtml
繁体地址,请注明出处:http://hk.pswp.cn/pingmian/96277.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

二进制安装MySQL 8.0指南:跨平台、自定义数据路径、安全远程访问配置

二进制安装 MySQL 8.0 在生产或测试环境中&#xff0c;我们常常希望避免包管理器带来的依赖和交互问题&#xff0c;尤其是当系统自带版本过旧或安装过程频繁弹窗时。此时&#xff0c;使用 MySQL 官方提供的二进制压缩包&#xff08;Generic Linux Binary&#xff09; 进行安装…

Z检验与T检验的区别与联系:原理、公式和案例全解

Z检验与T检验全解析&#xff1a;原理、区别与实际案例 统计学的核心任务之一&#xff0c;就是通过有限的样本数据去推断总体特征。在这一过程中&#xff0c;假设检验成为了最常见的工具。而在众多检验方法中&#xff0c;Z检验与T检验几乎是入门必学&#xff0c;也是应用最广泛的…

SpringBoot之缓存(最详细)

文章目录项目准备新建项目并选择模块安装添加依赖添加application.yml删除demos.web包编写pojo层userdto/ResultJson编写mapper层UserMapper编写service层UserService编写controller层编写配置类MybatisPlusConfig编写测试类1 缓存分类1.1 MyBatis一级缓存1.2 MyBatis二级缓存1…

B站 韩顺平 笔记 (Day 29)

目录 1&#xff08;集合的框架体系&#xff09; 2&#xff08;Collection接口和常用方法&#xff09; 2.1&#xff08;Collection接口实现类特点&#xff09; 2.2&#xff08;常用方法&#xff09; 2.3&#xff08;遍历元素方式1&#xff1a;迭代器&#xff09; 1&#x…

axios报错解决:unsupported BodyInit type

目录 问题 原因 解决方法 问题 Got ‘unsupported BodyInit type’ bug on iPhone 14(IOS 17.5) Issue #6444 axios/axios 我这里是iPhone 6plus打开会报错白屏 好多人遇到了相同的问题 当我在 iPhone 14 上浏览页面时,我收到一条错误消息:错误:不支持的 BodyInit 类型,…

iperf3网络性能测试工具

iperf3 是一个功能非常强大的网络性能测试工具,用于测量两个网络节点之间的最大TCP、UDP带宽和性能。它通过创建数据流并测量其吞吐量来工作。 下面我将为您详细介绍其核心用法、常用命令和参数。 核心概念:客户端/服务器模式 iperf3 测试需要两台机器:一台作为服务器端(…

【C#】 资源共享和实例管理:静态类,Lazy<T>单例模式,IOC容器Singleton我们该如何选

文章目录前言一、静态类1.1 静态类的特点1.2 静态类的使用1.3 静态类的缺点二、单例模式2.1 Lazy延迟初始化2.2 Lazy< T>单例模式的使用2.3 单例模式的特点三、IOC的Singleton总结前言 编写程序的时候&#xff0c;常常能碰到当某些数据或方法需要被整个程序共享&#xf…

MySQL——存储引擎、索引

一、存储引擎1.MySQL体系结构2.存储引擎简介存储引擎就是储存数据、建立索引、更新/查询数据等技术的实现方式。储存引擎是基于表的&#xff0c;而不是基于库的&#xff0c;所以存储引擎也可被称为表类型建表语句&#xff1a;查询数据库支持的储存引擎&#xff1a;show engines…

机器学习01——机器学习概述

上一章&#xff1a;机器学习核心知识点目录 下一章&#xff1a;机器学习02——模型评估与选择 机器学习实战项目&#xff1a;【从 0 到 1 落地】机器学习实操项目目录&#xff1a;覆盖入门到进阶&#xff0c;大学生就业 / 竞赛必备 文章目录一、参考书推荐二、机器学习的基本概…

Shell编程:检测主机ip所在网段内其他在线ip

一、逻辑设计获取本机 ip 及 网段循环检测网段内所有 ip判断 ping 结果&#xff0c;符合条件的输出相关信息二、代码展示#!/bin/bash#获取本机ip local_iphostname -I #local_ipip addr| grep "inet "|grep -v 127.0.0.1| awk {print $2}#获取本机网段 networkecho $…

Windows安装Chroma DB

安装步骤 安装python 3.8或以上的版本创建虚拟环境&#xff1a;python -m venv chroma_env激活虚拟环境&#xff1a;.\chroma_env\Scripts\activate安装Chroma DB&#xff1a;pip install chromadb(可选)安装扩展功能&#xff1a;pip install sentence-transformers pypdf tikt…

李彦宏亲自说

昨天&#xff0c;李彦宏亲自说&#xff1a;百度的数字人直播以假乱真&#xff0c;很多人是看不出这是数字人&#xff0c;而且转化率很高”这几个月百度一直在推“数字人”不再强调“大模型”了。数字人是AI落地最适合企业的一款产品&#xff0c;一般用于客服、面试、直播带货等…

JS 中bind、call、apply的区别以及手写bind

1.作用call、apply、bind作用是改变函数执行的上下文&#xff0c;简而言之就是改变函数运行时的this指向那么什么情况下需要改变this的指向呢&#xff1f;下面举个例子var name "lucy"; var obj {name: "martin",say: function () {console.log(this.nam…

vue2(7)-单页应用程序路由

1.单页应用程序如 单页&#xff1a;网易云&#xff0c;多页&#xff1a;京东单页应用程序&#xff0c;之所以开发效率高&#xff0c;性能高&#xff0c;用户体验好最大的原因是&#xff1a;页面按需更新 要按需更新&#xff0c;就要明确访问路径和组件的关系这时候就要用…

vue中通过heatmap.js实现热力图(多个热力点)热区展示(带鼠标移入弹窗)

直接上完整代码&#xff01;记录实现方式 注意heatmap.min.js需要通过heatmap.js提供的下载地址进行下载&#xff0c;地址放在下边 url&#xff1a;heatmap GIT地址 <template><div class"heatmap-view" ref"heatmapContainer"></div&g…

配置Kronos:k线金融大模型

github地址 网页btc预测demo使用的Kronos-mini模型 huggingface的仓库 文章目录配置环境安装python环境获取市场数据的库通过webui使用example中的例子prediction_example.py补充说明根据原例优化的代码CryptoDataFetcher单币对多周期预测配置环境 使用conda的环境. 首先进行换…

【Deep Learning】Ubuntu配置深度学习环境

【start: 250715】 文章目录ubuntu与深度学习安装cuda查看显卡信息&#xff08;nvidia-smi&#xff09;升级驱动下载cuda安装conda安装anaconda默认指向自己的conda初始化conda确认 conda.sh 被加载安装cuda-toolkit直接安装cuda-toolkit&#xff08;高级的&#xff09;安装高于…

车载数据采集(DAQ)解析

<摘要> 车载数据采集&#xff08;DAQ&#xff09;软件模块是现代汽车电子系统的核心组件&#xff0c;负责实时采集、处理、记录和传输车辆运行数据。本文系统解析了DAQ模块的开发&#xff0c;涵盖其随着汽车智能化演进的历史背景&#xff0c;深入阐释了信号、协议、缓存等…

强化学习框架Verl运行在单块Tesla P40 GPU配置策略及避坑指南

1.前言 由于比较穷,身边只有1块10年前的Tesla P40 GPU卡(2016年9月发布),想利用起来学习强化学习框架Verl。程序员学习开源代码,大部分人的第一直觉不是分析模块组成,而是跑起来试试,然后去debug一下后面的运行逻辑。 由于在官方部署指导文档中并未指明跑通Verl的最低…

leetcode169.多数元素

题目描述给定一个大小为 n 的数组 nums &#xff0c;返回其中的多数元素。多数元素是指在数组中出现次数 大于 ⌊ n/2 ⌋ 的元素。你可以假设数组是非空的&#xff0c;并且给定的数组总是存在多数元素。题目解法博耶-摩尔多数投票算法&#xff08;英语&#xff1a;Boyer–Moore…