遗传算法是一种进化算法

by Sina Habibian

通过新浪Habibian

我是如何设计一种算法的,该算法混合了到您镇上的乐队的播放列表 (How I designed an algorithm that mixes playlists of bands coming to your town)

This is a retrospective on funkavinci.com, a web project I worked on last summer. It was a series of weekly computer-generated playlists showcasing the best upcoming concerts in town.

这是对funkavinci.com的回顾,我是去年夏天工作的一个网络项目。 这是每周由计算机生成的一系列播放列表,展示了该镇即将举行的最佳音乐会。

Inspired by Spotify’s Discover Weekly, Funkavinci used an algorithm to generate a weekly playlist with 20 tracks. Each track corresponded to an artist who would be playing live during the following week. If a listener liked a track, they knew the artist was going to be in town and could purchase tickets to see them perform.

受Spotify的“发现每周”的启发,Funkavinci使用一种算法来生成包含20首曲目的每周播放列表。 每首曲目都对应一个艺术家,他将在下周进行现场表演。 如果听众喜欢这首歌,他们就知道这位艺术家将要去镇上,并可以购买门票观看他们的表演。

I recently ended support for Funkavinci after a few months of running it on the side. I’m writing this post to describe my process in building it and share some takeaways.

经过几个月的运行,我最近结束了对Funkavinci的支持。 我正在写这篇文章,以描述我的构建过程并分享一些收获。

动机 (Motivation)

I was discovering a lot of new music last summer. There were many acts I wanted to see live and who I knew would be performing in San Francisco sooner or later. I also wondered if a tool for music discovery could be built by monitoring artists who were touring through the city.

去年夏天,我发现了很多新音乐。 我想看许多现场表演,我知道谁迟早会在旧金山表演。 我还想知道是否可以通过监视在城市巡回演出的艺术家来构建音乐发现工具。

Services like Bands in Town and Songkick were partially addressing these ideas but had shortcomings. They sent daily notifications mentioning names of bands who were in town, but I had trouble recognizing the names. I was missing shows that I would have gone to. Doing some research, I found that this was a common problem. A more effective approach would be to shift the attention from the artist’s name to their songs and let the music speak for itself.

诸如Bands in Town和Songkick之类的服务部分解决了这些想法,但存在不足。 他们每天发送通知,提到镇上乐队的名字,但是我很难辨认出他们的名字 。 我错过了本该去的表演。 经过研究,我发现这是一个普遍的问题。 一种更有效的方法是将注意力从艺术家的名字转移到他们的歌曲上,并让音乐自己说话。

I also learned that concerts were becoming more important within the overall music industry. Musicians today depend on live music, instead of recorded music, for the majority of their income. Yet most concerts do not sell out. Building a service which outlined the best concerts in town would not only help fans discover music; it would also help musicians sell tickets.

我还了解到音乐会在整个音乐行业中变得越来越重要。 如今,音乐家的大部分收入都依靠现场音乐而不是录制音乐。 然而,大多数音乐会并没有卖光。 建立一个概述镇上最好的音乐会的服务,不仅可以帮助歌迷发现音乐,还可以帮助他们找到音乐。 这也将帮助音乐家出售门票。

I decided to build an app that would generate a new playlist every week with 20 tracks representing 20 upcoming concerts and deliver it to my email.

我决定开发一个应用程序,该应用程序每周会生成一个新的播放列表,其中包含代表20个即将举行的音乐会的20首曲目,并将其发送到我的电子邮件中。

解决方案原型 (Prototyping a Solution)

After checking out a few APIs, I decided to use Seatgeek as a source for up-to-date concert listings. They have a relatively complete database of events, provide a JSON API, and allow commercial use of their API.

在检查了一些API之后,我决定使用Seatgeek作为最新音乐会清单的来源。 他们具有相对完整的事件数据库,提供JSON API,并允许对其API进行商业使用。

To generate a playlist with the best concerts, I devised the following algorithm:

为了生成具有最佳音乐会的播放列表,我设计了以下算法:

  1. Query the Seatgeek API for all upcoming concerts in San Francisco for the following week. This would usually return around 100 events.

    查询Seatgeek API ,了解下周在旧金山举行的所有音乐会。 通常会返回大约100个事件。

  2. Extract the primary performer for each event and query the Spotify Search API for that artist.

    提取每个事件的主要表演者,并查询该艺术家的Spotify搜索API 。

  3. Query the Spotify top tracks API for the most popular track by each artist.

    查询Spotify热门曲目API ,以获取每个艺术家最受欢迎的曲目。

  4. Filter the resulting list to the top 20 tracks as ordered by popularity and add them to a Spotify playlist for listening. This was a list of the 20 best artists in town the following week, at least as decided by the popularity of their most popular track on Spotify.根据受欢迎程度将结果列表过滤到前20首曲目中,并将它们添加到Spotify播放列表中以进行收听。 这是第二周该镇20位最佳艺术家的名单,至少取决于他们在Spotify上最受欢迎的曲目的受欢迎程度。

I was pleasantly surprised by the outcome. The playlist format had put the music front and center. No longer intimidated by eccentric band names, I listened and fell in love with a couple of artists. Better yet, they were all touring through San Francisco so I saw them live in less than a week. I shared the playlist with a few friends who had similar results.

我对结果感到惊喜。 播放列表格式将音乐放在了首位。 我不再被古怪的乐队名字吓倒了,我倾听并坠入爱河。 更好的是,他们都在旧金山巡回演出,所以我看到他们住在不到一周的时间内。 我与一些结果相似的朋友分享了播放列表。

建立产品 (Building a Product)

I quickly realized that adding 20 popular tracks to a playlist does not make for a smooth listening experience. There were electronic, hip hop, and rock tunes showing up in sequence. Moreover, the Seatgeek and Spotify search data were not always perfect. There were occasionally artists who were not performing in town but had similar names to ones who were.

我很快意识到,将20首热门曲目添加到播放列表并不能带来流畅的聆听体验。 依次出现电子音乐,嘻哈音乐和摇滚音乐。 而且,Seatgeek和Spotify搜索数据并不总是完美的。 偶尔会有一些艺术家不在城里表演,但名字和当时的艺术家相似。

I modified the algorithm to add the top 50 tracks to a private playlist. I would personally listen to these and prune to keep a top 20. I made sure that the artists were all performing in the city and that the music flowed through the playlist as a whole.

我修改了算法,将前50首曲目添加到私人播放列表中。 我会亲自聆听这些内容,然后修剪以保持前20名的位置。我确保所有艺术家都在这座城市里表演,并且音乐在整个播放列表中流通。

I built a Rails app to manage the various playlists, shows, artists, and tracks. I added an admin UI that would allow me to visualize, add, or remove these various entities.

我构建了一个Rails应用程序来管理各种播放列表,节目,艺术家和曲目。 我添加了一个管理界面,使我可以可视化,添加或删除这些各种实体。

There was a clean underlying structure linking artists to playlists and playlists to the city. This meant that in the future, I could add an abstraction layer to the backend to generate playlists for other cities as well.

有一个干净的底层结构将艺术家与播放列表和城市的播放列表联系起来。 这意味着将来我可以在后端添加一个抽象层,以生成其他城市的播放列表。

I then moved onto the user facing site. I used a card-based layout to showcase the concerts and complement the playlist. This layout would also allow for easy experimentation and re-ordering if I ever decided to personalize the playlists for the logged in user.

然后,我进入了面向用户的网站。 我使用基于卡片的布局来展示音乐会并补充播放列表。 如果我决定个性化已登录用户的播放列表,此布局还可以方便地进行实验和重新排序。

到野外 (Into the Wild)

I pushed the site live in August. A group of friends signed up at first and the reach grew organically over the following weeks.

我在8月将网站推向现场。 最初有一群朋友签约,其影响力在接下来的几周内有机增长。

The Funkavinci playlist was delivered as a weekly newsletter every Sunday morning at 10am. The email provided a morsel of value and built a sense of expectation around it’s weekly arrival. Users were able to simply forward the email to friends, creating an organic pathway for growth.

Funkavinci播放列表作为每周时事通讯在每个星期日上午10点发布。 这封电子邮件提供了一些有价值的信息,并在每周的到来中建立了一种期待感。 用户可以简单地将电子邮件转发给朋友,从而为增长创造了有机的途径。

Another growth hack was to use the Spotify social feed to spread awareness. The playlists had names like “Funkavinci.com | 12/29–01/05”. If someone found a friend listening to the playlist and wanted to find out more, they could simply visit the website.

另一个增长技巧是使用Spotify社交Feed传播意识。 播放列表的名称类似“ Funkavinci.com | 12 / 29–01 / 05 ”。 如果有人找到一个朋友在听播放列表,并想了解更多信息,他们可以直接访问该网站。

The process of putting together the weekly playlist was automated and took an hour of time per week. I would listen to 50 tracks and write a conversational blurb announcing the new playlist. This was included on the site and the newsletter.

每周播放列表的整理过程是自动化的,每周花费一个小时的时间。 我会听50首曲目,然后写一段对话性的Blub宣布新的播放列表。 该内容包含在网站和新闻通讯中。

我的外卖 (My Takeaways)

As I close Funkavinci and move onto other things, some of my notes for myself are:

当我关闭Funkavinci并转到其他内容时,对我自己的一些注意事项是:

了解使用外部API的利弊 (Understand the pros and cons of using external APIs)

At one point, I entertained the idea of growing Funkavinci into a business. I was hearing regular accounts of friends purchasing tickets and going to concerts because of the service. I wondered if it could scale into something larger.

有一次,我接受了将Funkavinci发展成一家公司的想法。 由于服务的缘故,我经常听到朋友购买机票和参加音乐会的账目。 我想知道它是否可以扩大规模。

I ultimately decided against this due to a number of reasons, one of which was that Funkavinci was in a low-leverage position. It owned neither the content (i.e. the music) nor the data (i.e. listening metrics on Spotify or purchasing metrics on ticketing sites).

出于多种原因,我最终决定对此表示反对,其中之一是Funkavinci处于低杠杆状态。 它既不拥有内容(即音乐)也不拥有数据(即Spotify上的收听指标或票务网站上的购买指标)。

Building a consumer app requires deep insight into user behavior and I didn’t have access to important data points. A potential solution would have been to curb the reliance on Spotify (or it’s alternative Soundcloud) by independently hosting music and providing a media player. Sites like 8tracks or Resident Advisor follow this approach. This entails added complications, including the handling of music rights, and did not seem worthwhile given the limited upside.

构建消费者应用程序需要深入了解用户行为,而我无权访问重要数据点。 潜在的解决方案是通过独立托管音乐并提供媒体播放器来减少对Spotify(或其替代Soundcloud)的依赖。 像8tracks或Resident Advisor这样的网站都遵循这种方法。 这就带来了更多的复杂性,包括音乐权利的处理,而且鉴于上行空间有限,这似乎并不值得。

APIs allow us to leverage existing platforms and build solutions that would not have been possible otherwise. They can also put one in a low leverage position where one depends on an external platform for mere existence or for access to crucial data.

API使我们能够利用现有平台并构建原本无法实现的解决方案。 他们还可以将某人置于低杠杆状态,因为人们只能依靠外部平台来生存或访问关键数据。

启动宣传项目 (Kick off projects with a push for publicity)

With Funkavinci, I fell into a classic engineer trap of shying away from publicity. Holding high standards for the product and still harboring traces of old perfectionist tendencies, I thought the app was not ready for prime time. I therefore did not make a real effort at marketing and only shared it in a few online forums.

在Funkavinci的帮助下,我陷入了一个经典的工程师陷阱,回避宣传。 坚持产品的高标准,并且仍然保留着旧的完美主义倾向的痕迹,我认为该应用程序尚未准备就绪。 因此,我在营销方面并没有做出真正的努力,仅在一些在线论坛上进行了分享。

I’ve now learned that publicizing a project early on can be very helpful. It will help create an early community of users who inform your decisions. Moreover, and perhaps more importantly in the early days, it will provide you with a sense of increased accountability and motivation.

我现在了解到,尽早发布项目会很有帮助。 这将有助于建立一个早期社区,为您提供决策依据的用户。 而且,也许更重要的是在初期,它会为您提供增强的责任感和动力感。

选择易于发音和拼写的名称 (Pick names that are easy to pronounce and to spell)

As the saying goes: “there are only two hard things in Computer Science: cache invalidation and naming things.” The same applies to products. I picked the name Funkavinci as it brought to mind an image of a funky DaVinci and because it was edgy. Watching multiple people struggle with pronouncing or spelling it taught me a valuable lesson.

俗话说:“计算机科学中只有两件事:缓存失效和命名。” 产品同样如此。 我之所以选择Funkavinci这个名字,是因为它让人联想起时髦的达芬奇,并且因为它很前卫。 看着多个人为发音或拼写而苦苦挣扎,这教会了我一个宝贵的教训。

With that, I bid farewell to a fun project, and move onto the next.

这样,我就告别了一个有趣的项目,然后转到下一个项目。

Want to say hi? Ping me on Twitter.

想打个招呼吗? 在Twitter上将我ping通。

翻译自: https://www.freecodecamp.org/news/the-machine-made-playlist-faec2c8bc7ba/

遗传算法是一种进化算法

遗传算法是一种进化算法_我是如何设计一种算法的,该算法混合了到您镇上的乐队的播放列表...相关推荐

  1. 深度学习算法和机器学习算法_啊哈! 4种流行的机器学习算法的片刻

    深度学习算法和机器学习算法 Most people are either in two camps: 大多数人都在两个营地中: I don't understand these machine lea ...

  2. 6种java垃圾回收算法_被说烂了的Java垃圾回收算法,我带来了最“清新脱俗”的详细图解...

    一.概况 理解Java虚拟机垃圾回收机制的底层原理,是系统调优与线上问题排查的基础,也是一个高级Java程序员的基本功,本文就针对Java垃圾回收这一主题做一些整理与记录.Java垃圾回收器的种类繁多 ...

  3. 文本处理算法_基于 Python 的 11 种经典数据降维算法

    网上关于各种降维算法的资料参差不齐,同时大部分不提供源代码.这里有个 GitHub 项目整理了使用 Python 实现了 11 种经典的数据抽取(数据降维)算法,包括:PCA.LDA.MDS.LLE. ...

  4. 机器学习算法_明确解释:4种机器学习算法

    您是涉足机器学习的数据科学家吗? 如果是,那么您应该阅读此内容. 定义,目的,流行算法和用例-全部说明 > Photo by Andy Kelly on Unsplash 机器学习已经从科幻小说 ...

  5. mysql数据库算法_数据库:MySQL索引背后的数据结构及算法原理【转】

    原文:http://blog.codinglabs.org/articles/theory-of-mysql-index.html 摘要 本文以MySQL数据库为研究对象,讨论与数据库索引相关的一些话 ...

  6. qlearning算法_通过OpenAI Gym编写第一个强化学习算法

    腾讯互娱Turing Lab从创建开始,每周在内部进行分享读书会,对业界的技术研究和应用进行讨论.在此通过公众号形式把相关有趣内容也推送给对新技术和业界趋势感兴趣的朋友. 和大量的所谓技术公众号不同, ...

  7. python实现排序算法_数据结构之(3)python实现排序算法

    常用排序与插入算法 冒泡排序 冒泡排序(英语:Bubble Sort)是一种简单的排序算法.它重复地遍历要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来.遍历数列的工作是重复地进行直 ...

  8. 协同过滤算法_机器学习 | 简介推荐场景中的协同过滤算法,以及SVD的使用

    本文始发于个人公众号:TechFlow,原创不易,求个关注 今天是机器学习专题的第29篇文章,我们来聊聊SVD在上古时期的推荐场景当中的应用. 推荐的背后逻辑 有没有思考过一个问题,当我们在淘宝或者是 ...

  9. 关联规则挖掘算法_关联规则的挖掘与应用——Apriori和CBA算法

    文|光大科技大数据部  魏乐 卢格润 1  关联规则 1.1 关联规则基本概念 1.2 Apriori算法基本思路 2  关联分类 2.1  CBA关联分类算法思路 2.2  CBA算法实现 总结 关 ...

最新文章

  1. Windows7 连接Windows Server服务器时提示:计算机无法连接到远程计算机上的另一个控制台会话。...
  2. 站长们都会,但是都会写错的robots!
  3. 计算机二级证书如何考取,计算机二级证书怎么领 考试成绩怎么算
  4. zune linux_快速提示:在出售Zune HD之前,先擦除所有内容
  5. 排序算法之--归并排序(好玩的一个算法o。o)快速入门
  6. Vue第一部分(2): 数据的渲染
  7. NextArch Foundation 下一代架构基金会
  8. Problem J: 零起点学算法89——程序设计竞赛
  9. xp_cmdshell 用法
  10. 十大验证码解决方案服务比较
  11. 使用码云(Gitee)进行开源代码管理
  12. android 关联dicom文件,基于Android的DICOM浏览器的开发
  13. Android面试总结系列之面试技巧
  14. 《太极张三丰》原声音乐 320/mp3打包下载
  15. 内存数据网格IMDG简介
  16. 家里的老电脑,是升级硬件好,还是重新买一个好?
  17. Java设计模式策略模式(附实例代码)每天一学设计模式
  18. QtCreator 忽略指定警告
  19. FastAdmin自定义批量操作
  20. 《《《翻译》》》pointfusion三维包围盒

热门文章

  1. 超简单!用思维导图来做PEST分析
  2. 2023年中国碳纤维行业报告
  3. Spring Boot连接SQLite数据库
  4. IC学习笔记19——Gvim的简易操作
  5. 年后跳槽必看!50家互联网公司年终奖情况!(1.30 日最新版)
  6. 龙蜥社区 6 月技术委员会会议召开!欢迎 5 位开放原子 TOC 导师加入
  7. SQL Server CONVERT() 函数
  8. 【渝粤教育】电大中专药事管理与法规_1作业 题库
  9. [转]车载电子操作系统:QNX与Linux未来有望两家独大
  10. sharepoint WSP安装包安装、删除、更新