2019年最新的机器学习项目

作者: 疯狂的技术宅 | 来源:发表于2019-05-06 16:33 被阅读120次

    翻译:疯狂的技术宅
    原文:https://www.edureka.co/blog/machine-learning-projects/

    机器学习显然是一个在近几年里疯狂进步的领域。这一趋势和进步为该行业创造了许多就业机会。对机器学习工程师的需求很高,这种激增是由于技术的发展和巨大的产生数据量大数据。在本文中,我将按以下顺序讨论你绝对应该知道和使用的机器学习项目:

    • 什么是机器学习?
    • 机器学习的步骤
    • 机器学习的类型
    • 行业用例
    • 2019年开源机器学习项目

    什么是机器学习?

    机器学习是一个概念,它允许机器从示例和经验中进行学习,而且不用去明确的进行编程。因此你不是去写代码,而是需要将数据提供给通用算法,算法或机器会根据给出的数据构建逻辑。


    Who is an ML Engineer

    机器学习的步骤

    任何机器学习算法都遵循一个共同的模式或步骤:

    机器学习的步骤

    收集数据:此阶段涉及从各种来源收集所有相关数据

    数据处理:对“原始数据”进行清洗并转换为方便处理的格式的过程

    分析数据:通过分析对数据进行选择和过滤,以准备模型所需的数据

    训练算法:算法在训练数据集上进行训练,通过该算法理解数据的模式和规则

    测试模​​型:通过测试数据集来检测所生成模型的准确性。

    部署:如果模型的速度和准确性是可接受的,那么该模型应该被部署在真实系统中。在根据其性能部署模型之后,如果性能下降,模型将会被重新训练,然后更新和改进模型。

    机器学习的类型

    机器学习分为三类:

    机器学习的类型

    监督学习:使用算法来学习从输入变量(x)到输出变量(Y)的映射函数。

    监督学习

    无监督学习:有时候给出的数据是非结构化和未标记的。所以很难把这些数据分到不同的类别中。无监督学习有助于解决这个问题,它利用基于统计的特性将输入的数据进行聚类。

    聚类

    强化学习:为了在特定情况下得到最大化奖励而采取适当的行为。

    在强化学习方面,并没有预期的产出。在执行给定任务时由增强代理决定要采取的操作。在没有训练数据集的情况下,从其经验中学习。

    接下来让我们看一些能够帮助公司创造利润的真实机器学习项目。

    行业用例

    1. MOTION STUDIO

    领域:媒体

    焦点:优化选择过程

    motion studio

    业务挑战: Motion Studio 是欧洲最大的无线广播节目制作公司。该公司的年收入超过十亿美元,他们决定推出一个新的真人秀节目:RJ Star。观众们对节目的反响是史无前例的,公司收到了大量的语音片段。作为 ML 专家,你必须将声音分类为男性或女性,以便能够更快的进行初选流程。

    关键问题:语音样本的音调。

    商业利益:由于 RJ Star 是一个真人秀,选择候选人的时间非常短。整个节目的成功和利润取决于是否能够快速和顺利的执行。

    import pandas as pd
    import numpy as np
    import matplotlib.pyplot as plt
    import seaborn as sns
    %matplotlib inline
    import warnings
    warnings.filterwarnings('ignore')
    
    df = pd.read_csv('voice-classification.csv')
    df.head()
    
    op-1
    # Check the no. of records
    df.info()
     
    df.describe()
     
    df.isnull().sum()
    
    op-2
    print ("Shape of Data:" , df.shape)
    print("Total number of labels: {}".format(df.shape[0]))
    print("Number of male: {}".format(df[df.label == 'male'].shape[0]))
    print("Number of female: {}".format(df[df.label == 'female'].shape[0]))
    
    op-3
    X=df.iloc[:, :-1]
    print (df.shape)
    print (X.shape)
    
    op-5
    from sklearn.preprocessing import LabelEncoder
    y=df.iloc[:,-1]
     
    gender_encoder = LabelEncoder()
    y = gender_encoder.fit_transform(y)
     
    from sklearn.preprocessing import StandardScaler
    scaler = StandardScaler()
    scaler.fit(X)
    X = scaler.transform(X)
     
    from sklearn.model_selection import train_test_split
    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=100)
     
    from sklearn.svm import SVC
    from sklearn import metrics
    from sklearn.metrics import classification_report,confusion_matrix
     
    svc_model=SVC()
    svc_model.fit(X_train,y_train)
    y_pred=svc_model.predict(X_test)
     
    print('Accuracy Score:')
    print(metrics.accuracy_score(y_test,y_pred))
    
    op-6
    print(confusion_matrix(y_test,y_pred))
    
    op-7

    2. LITHIONPOWER

    领域:汽车

    焦点:激励驾驶员

    Lithion Power

    业务挑战: Lithionpower 是最大的电动汽车(e-vehicle)电池供应商。司机通常会为一天的出行去租用电池,用公司充满电的电池换下旧电池。 Lithionpower 根据司机的驾驶历史记录提供可变定价模型。由于电池寿命取决于是否超速和每天行驶的距离等因素,你作为 ML 专家必须创建一个聚类模型,根据驾驶数据将驾驶员进行分组。

    关键问题:将根据聚类情况对司机进行激励,因此分组必须准确。

    商业利益:利润增加高达15-20%,因为历史记录较差的司机将被收取更多的费用。

    import pandas as pd
    import numpy as np
    import matplotlib.pyplot as plt
    import seaborn as sns
    sns.set() # for plot styling
    %matplotlib inline
    import warnings
    warnings.filterwarnings('ignore')
    import matplotlib.pyplot as plt
    plt.rcParams['figure.figsize'] = (12, 6)
     
    df=pd.read_csv('driver-data.csv')
    df.head()
    
    op-8
    df.info()
     
    df.describe()
    
    op-9
    from sklearn.cluster import KMeans
     
    #Taking 2 clusters
    kmeans = KMeans(n_clusters=2)
    df_analyze = df.drop('id',axis=1)
     
    kmeans.fit(df_analyze)
    
    op-10
    kmeans.cluster_centers_
    
    op-11
    print (kmeans.labels_)
    print (len(kmeans.labels_))
    
    op-12
    print (type(kmeans.labels_))
    unique, counts = np.unique(kmeans.labels_, return_counts=True)
    print(dict(zip(unique, counts)))
    
    op-13
    df_analyze['cluster'] = kmeans.labels_
    sns.set_style('whitegrid')
    sns.lmplot('mean_dist_day','mean_over_speed_perc',data=df_analyze, hue='cluster',
    palette='coolwarm',size=6,aspect=1,fit_reg=False)
    
    op-14-Machine-Learning-Projects
    #Now, Let's check the clusters, when n=4
    kmeans_4 = KMeans(n_clusters=4)
    kmeans_4.fit(df.drop('id',axis=1))
    kmeans_4.fit(df.drop('id',axis=1))
    print(kmeans_4.cluster_centers_)
    unique, counts = np.unique(kmeans_4.labels_, return_counts=True)
     
    kmeans_4.cluster_centers_
    print(dict(zip(unique, counts)))
    
    op-15-Machine-Learning-Projects
    df_analyze['cluster'] = kmeans_4.labels_
    sns.set_style('whitegrid')
    sns.lmplot('mean_dist_day','mean_over_speed_perc',data=df_analyze, hue='cluster',
    palette='coolwarm',size=6,aspect=1,fit_reg=False)
    
    op-16

    3. BluEx

    领域:物流

    焦点:最佳路径

    bluex

    业务挑战: BluEx 是印度领先的物流公司。然而他们面临的挑战是其面包车司机的投递路线并非最优。这导致投递延迟和更高的燃料成本。作为 ML 专家,你必须使用强化学习创建 ML 模型,以便通过该程序找到最佳路径。

    关键问题:数据有很多属性,分类可能会很棘手。

    商业利益:通过采用最佳路径,节省的燃料成本可高达15%。

    import numpy as np
    import pylab as plt
    import networkx as nx
     
    #Initializing points
    points_list = [(0,1), (1,5), (5,6), (5,4), (1,2), (2,3), (2,7)]
     
    goal = 7
    mapping={0:'Start', 1:'1', 2:'2', 3:'3', 4:'4', 5:'5', 6:'6', 7:'7-Destination'}
    G=nx.Graph()
    G.add_edges_from(points_list)
    pos = nx.spring_layout(G,k=.5,center=points_list[2])
    nx.draw_networkx_nodes(G,pos,node_color='g')
    nx.draw_networkx_edges(G,pos,edge_color='b')
    nx.draw_networkx_labels(G,pos)
    plt.show()
    
    Reinforcement Learning
    NO_OF_POINTS = 8
     
    #Inititlaizing R Matrix
    R = np.matrix(np.ones(shape=(NO_OF_POINTS, NO_OF_POINTS)))
    R *= -1
    
    for point in points_list:
      print(point)
      if point[1] == goal:
        R[point] = 150
      else:
        R[point] = 0
    
      if point[0] == goal:
        R[point[::-1]] = 150
      else:
        # reverse of point
        R[point[::-1]]= 0
    
    
    rl-1
    R[goal,goal]= 150
    R
    
    rl-2-Machine-Learning-Projects
    Q = np.matrix(np.zeros([NO_OF_POINTS,NO_OF_POINTS]))
    
    # The learning parameter
    gamma = 0.8
     
    initial_state = 1
     
    def available_actions(state):
      current_state_row = R[state,]
      av_act = np.where(current_state_row >= 0)[1]
      return av_act
    
    available_act = available_actions(initial_state)
    
    def sample_next_action(available_actions_range):
      next_action = int(np.random.choice(available_act,1))
      return next_action
    
    action = sample_next_action(available_act)
    
    def update(current_state, action, gamma):
      max_index = np.where(Q[action,] == np.max(Q[action,]))[1]
    
      if max_index.shape[0] > 1:
        max_index = int(np.random.choice(max_index, size = 1))
      else:
        max_index = int(max_index)
        max_value = Q[action, max_index]
    
      Q[current_state, action] = R[current_state, action] + gamma * max_value
      print('max_value', R[current_state, action] + gamma * max_value)
    
      if (np.max(Q) > 0):
        return(np.sum(Q/np.max(Q)*100))
      else:
        return (0)
    
    update(initial_state, action, gamma)
    
    scores = []
    for i in range(700):
      current_state = np.random.randint(0, int(Q.shape[0]))
      available_act = available_actions(current_state)
      action = sample_next_action(available_act)
      score = update(current_state,action,gamma)
      scores.append(score)
      print ('Score:', str(score))
     
    print("Trained Q matrix:")
    print(Q/np.max(Q)*100)
     
    # Testing
    current_state = 0
    steps = [current_state]
     
    while current_state != 7:
        next_step_index = np.where(Q[current_state,] == np.max(Q[current_state,]))[1]
      if next_step_index.shape[0] > 1:
        next_step_index = int(np.random.choice(next_step_index, size = 1))
      else:
        next_step_index = int(next_step_index)
      steps.append(next_step_index)
      current_state = next_step_index
    
    print("Most efficient path:")
    print(steps)
     
    plt.plot(scores)
    plt.show()
    

    2019 年开源机器学习项目

    Detectron: Detectron 是 Facebook AI Research 的软件系统,它实现了最先进的物体检测算法。它是用 Python 编写的,由 Caffe2 深度学习框架提供支持。

    detectron

    Detectron 的目标是为物体检测研究提供高质量、高性能的代码库。它的宗旨在于灵活,以此支持新颖研究的快速实施和评估。它包含50多个预训练模型。

    项目链接:https://github.com/facebookresearch/Detectron


    Denspose:它的功能是在将 RGB 图片中的所有人物映射到 3D 人体模型的表面。 DensePose-RCNN 基于Detectron 框架中实现。

    denspose

    项目链接:https://github.com/facebookresearch/DensePose


    TensorFlow.js: 它是一个用于开发和训练 ML 模型并在浏览器中部署的库。自时候发布以来,它已成为一个非常受欢迎的版本。有了它你就可以:

    tensorflow-js
    • 在浏览器中进行机器学习:通过灵活直观的API,可以使用低级 JavaScript 线性代数库或高级 API 从头开始构建模型。
    • 运行现有模型:使用 TensorFlow.js 的模型转换器直接在浏览器中运行已有的 TensorFlow 模型。
    • 重新训练现有模型:使用连接到浏览器的传感器数据或其他客户端数据重新训练已有的 ML 模型。

    项目链接:https://github.com/tensorflow/tfjs


    Waveglow:
    机器学习也在音频处理方面取得了重大进步,它不仅仅是产生音乐或进行分类。 WaveGlow 是 NVIDIA 的基于流的语音合成生成网络。如果你想从头开始训练自己的模型的话,研究人员还列出了你可以遵循的步骤。

    waveglow logo

    项目链接:https://github.com/NVIDIA/waveglow


    Image Outpainting: 如果你只有有一个场景的半张图片,但是想要完整的风景,Image Outpainting 可以帮你做到。该项目是 Keras 基于斯坦福大学的图像修复论文的实现。

    image-outpainting

    这是一个所有机器学习爱好者必须要去尝试的例子,逐步进行了详细的解释。就个人而言,这是我最喜欢的机器学习项目。

    项目链接:https://github.com/bendangnuksung/Image-OutPainting


    Deep Painterly Harmonization:关于图像方面,这个是杰作。这个算法的作用是:将图像作为输入,如果向图像添加外部元素,它会把该元素混合到原图的环境中,就好像是它的一部分。

    deep-painterly-harmonization

    你能分辨出来吗?很难吧?这向我们展示了机器学习方面取得的最新进展。

    项目链接:https://github.com/luanfujun/deep-painterly-harmonization


    DeepMimic:仔细看看这里的图像,你会看到一个火柴人的形象在做回旋踢踢、后空翻和侧手翻。这是我的朋友正在加强学习。 DeepMimic 是一个基于物理学的角色技能引导方面的深度强化学习示例。

    DeepMimic

    项目链接:https://github.com/xbpeng/DeepMimic


    Magenta: Magenta 是一个研究机器学习在创造艺术和音乐过程中的作用的研究项目。这主要涉及开发新的深度学习和强化学习算法,用来生成歌曲、图像、绘图等。

    magenta logo

    它也是构建智能工具和界面的探索,允许艺术家和音乐家用这些模型扩展(不是替换!)他们的创作过程。展开你的翅膀,为 Instagram 或 Soundcloud 创造你独特的内容,成为一个有影响力的人。

    项目链接:https://github.com/tensorflow/magenta


    这篇关于机器学习项目的文章到此就结束。试着运行这些例子,并在下面的评论部分告诉我们。希望你能了解机器学习在不同行业中的实际应用。

    相关文章

      网友评论

        本文标题:2019年最新的机器学习项目

        本文链接:https://www.haomeiwen.com/subject/ksldoqtx.html