Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: pub@towardsai.net
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Take our 85+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

Publication

An AI Practitioner’s Guide to the Kdrama Start-Up (Part 2)
Latest   Machine Learning

An AI Practitioner’s Guide to the Kdrama Start-Up (Part 2)

Last Updated on July 21, 2023 by Editorial Team

Author(s): Jd Dantes

Originally published on Towards AI.

Artificial Intelligence

Generating fun with adversarial networks (GANs).

Episode 7. Who’s GANna change the light bulb? I see they’re getting adversarial here. (Sorry.) Images are screenshots by the author unless stated otherwise.

In the previous post, we talked about neural networks, training, and loss. We’ll now dive into generative networks, as well as talk a bit more about what Start-Up touched on, besides the technical know-how.

Let’s pick up where we left off!

SPOILER WARNING: You may want to proceed only if you’ve finished the series.

#2 It’s actually pretty well-researched (continued).

Episode 3. Note the (1) Generator, (2) Discriminator, and (3) expression on the upper right with the log and triangle symbols.

Let’s go back to the scene where Dosan mentions two neural networks. On the whiteboard you’ll see the terms generator and discriminator, as well as some formula on the upper right with the log and whatnot.

These actually refer to Generative Adversarial Networks, or GANs. Why generative? As opposed to the typical neural network which takes an input image and outputs a classification like “dog” or “cat”, with GANs you have the opposite. You say that you want a dog, and its output is an image of a dog. Actually, it can generate a full spectrum of dog images — from short, fluffy Pomeranians to bigger Golden Retrievers.

A Pomeranian. Photo by Bundo Kim on Unsplash

So where are the two neural networks? You may have guessed it — the generator is one neural network, while the discriminator is yet another neural network.

While the generator is new to us, the discriminator functions as a classifier that we’re used to. Give it an input image and it tells you if it’s a dog or a cat. Except this time, the input image can come from either (1) actual training images, or (2) a fake image created by the generator! You can see this in the diagram on the whiteboard.

The discriminator tries to guess if the image is real (“1”) or a fake from the generator (“0”).

So usually we can assign the neural network to output “1” for a dog and “0” for a cat; in this case, there’s another difference. Rather than saying if it’s a dog or a cat, the discriminator instead predicts if the image is real or not. If the output is “1”, then the discriminator is guessing that the image is real, while an output close to “0” is a guess that the image was a fake created by the generator.

That’s it! If you’ve searched about GANs, then you’ve probably seen the analogy of the discriminator as a police officer trying to catch a criminal creating counterfeits (the generator in this case). Or in Dalmi’s case, trying to find out the real Dosan who sent the letters 15 years back.

Episode 7. Looks like Dalmi won’t be too effective as a discriminator.

So the discriminator tries to spot the discrepancies to know if it’s a fake.

Episode 3. Injae: “Did you start a funding round?”

When the generator gets caught though, it learns, and tries to step up its game.

Episode 3. How to be a hotshot CEO? Say the lyrics of the national anthem.

After several repetitions of this back-and-forth of getting caught and learning to create better counterfeits, the generator becomes so good that the discriminator gets totally confused and can’t tell which is which. Like Dalmi earlier.

Or in some cases, maybe not. (GANs could be pretty hard to train to convergence.)

Episode 9. GANs can be tricky. Don’t try this at home, it’s bad for relationships. (Kidding, but not about the training part.)

What about the equation with the log stuff?

Again, if you’d rather skip this part, feel free to go ahead. But if this is of interest, then read on. 🙂

Let’s go back again to the whiteboard. We’ve gone through the generator and the discriminator, but haven’t touched the formula on the upper right corner. Let’s zoom in on that, but grab the one from the official paper so things are easier to see:

The equation from the paper. We’ll deconstruct this in a bit.

Without the context, that may look confusing at first. Let’s break it down.

From the discriminator’s point of view, we want to have a high score for the real images that are predicted as “1”, as well as for artificial images that were correctly detected as fake (tagged as “0”). In pseudocode, it would be something like:

We want to encourage the discriminator when it tags real images as “1”, and fake images near “0”.

Then, over all training images (whether real or generated), we want the total score to be as high as possible.

So how does this translate into the equation? Recall that part in the previous post, where we used the absolute value for the loss? Translated to pseudocode, it would have been something like:

In Part 1, we computed U+007C(100–150)U+007C = 50. We took the absolute value (the vertical bars) so that the numbers are not negative.

But instead of manually coding for the corner case, it turned out that there are other mathematical operations that are convenient, like squaring the numbers.

For the case of GANs, we can try to do the same. To represent the if-else logic, what mathematical operation or function can we use to toggle between “1” and “0”? You’ve probably guessed it — we can use the logarithm! If you’ve forgotten what a logarithm is, you can look at this graph:

log(x) is zero when x=1, and approaches negative infinity when x is near zero. View with graph.tk or WorlframAlpha

The logarithm as we approach zero is negative infinity, and the logarithm of one is zero. So if we wanted to maximize things, we don’t want them heading towards negative infinity, and try to get the sum towards zero instead. So in our pseudocode from earlier, negative infinity would be considered the LOW score, while a score near zero would be HIGH.

Let’s go through the case where the image is real. If the prediction ~1, then log(~1) = 0 (HIGH). If the prediction ~0, this is wrong, and log(~0) would evaluate to negative infinity; this is a bad score, so the neural network will learn to penalize such mispredictions. This is represented by the first term of our objective function:

For real images, the discriminator (D) should output near 1. log(~1) = 0 (HIGH). If it mispredicts it to be near 0, log(~0) approaches negative infinity (LOW), so the score is penalized. The Ex~pdata(x) thing just means get from the real images (i.e., the training data).

How about the case when the image is a fake created by the generator? The flow is similar, but first let’s smoothen out the notation. When we write D(x), this means the prediction of the discriminator for some image x. Again, D(x) = 1 means that it’s predicting the image x to be real, while D(x) = 0 is a guess that it’s a fake. For the generator, its output is not a prediction, but an image. So G(z) for some input z is an image. You don’t have to mind the z here, it can be anything, even random noise, such that if you change it a bit, you’ll be sweeping across the spectrum of possible images that can be produced (e.g., from a Pomeranian to a Golden Retriever).

So if the discriminator takes in a generated image as input, we write it as D(G(z)). Now, for this case, we don’t want to just take the logarithm directly. For a proper discriminator, D(G(z)) should be close to zero (i.e., it catches it as fake). If we take the logarithm directly, then log(D(G(z)) = log(~0) which approaches negative infinity (LOW). We’d be penalizing the discriminator for doing its job properly in catching the fakes. What can we do?

We can just flip things around! Rather than taking the log of D(G(z)), we can just take the log of (1 — D(G(z))! This way, things would be reversed. For fake images, log(1 — D(G(z)) = log (1 — predicted closed to zero) = log(1) = 0 (HIGH)!

Hence, we get…

For fake images, we want to score HIGH when D outputs ~0 correctly. The trick is just to flip it by subtracting from 1 before taking the logarithm!

…applicable to the fake images. See the Ez~pz(z)? That’s just shorthand for “over all fake images” (remember that z denotes the input to the generator, which can just be random noise).

So when we add them, we get the equation from before which the discriminator wants to maximize:

Sum both terms. The discriminator wants to have a high score, just like in a game!

Now, the generator wants the opposite to happen — that’s why they’re called adversarial networks! So it wants to minimize things…

The adversarial game. We got to the original equation earlier!

…which is the equation from before!

So the two networks are in a two-player minimax game, each doing their own gradient descent (or ascent). Training stops at equilibrium, where the generator has become so good that the discriminator can’t tell real from fake. So at this point, the discriminator really is just at 50% accuracy — essentially no different from doing a coin toss.

And we’re done, great! You can now understand the random scribbles behind Dosan. I doubt you’d use them to talk about people though, haha.

GAN Applications — more fun stuff!

You may not use GANs in casual conversation, but they do have their interesting applications. Look at the picture below. Can you guess which one is real, and which one isn’t?

Which one is real, which one is fake? Picture from this article, from this paper.

Do you have your guess?

Well, both of them are fakes created by GANs! Amazing, right? You can refer to the paper and other articles for more details.

Aside from images, GANs can be used for video too! Just look at Injae here:

Oh, another video of Injae. Wait, she looks a bit different… Source

…except that the person there is Tzuyu, a K-pop group member, and not the actual actress Kang Hanna.

I’ve only shown these, but really, there are many more applications of GANs. If you’d like to learn more, I would recommend searching for compilation articles like this one (or his whole GAN series here), or look for “awesome Git” repositories like this one, or this other one.

Aside from being fun, GANs have potential for use in specific industries like media and graphics. Or simply for general machine learning! GANs can be used to generate training data to improve neural networks. Remember the face-off between Injae and Dalmi? GANs could possibly be used to improve models designed for detecting counterfeit.

Episode 5. Injae’s team creates fonts using AI, while Samsan’s tech tries to detect counterfeits.

And that’s all about GANs for now! Aside from the technical content that we’ve gone through, the show also managed to get a few more little things correct, such as:

  • The use of Linux (Ubuntu). Developers (even for software outside machine learning, like websites) tend to use Linux as their operating system. Not only is it open source and free to use, but the tools and environment as a whole are generally easier to work with compared to if you were developing on other operating systems.
Episode 11. They’re actually using Linux (Ubuntu), a common operating system for developers.
  • Actually using code for AI. The programming languages and libraries that they used are actually for AI. We see lots of examples of this during the hackathon episode.
  • For starters, they’re using actual programming libraries for machine learning. Numpy is used for representing data as matrices, sklearn (scikit-learn) is useful for modeling data, and matplotlib is for visualizations. The code itself is in Python, one of the most common programming languages used for this kind of stuff.
Episode 5. They’re actually using the standard tools for machine learning.
  • Weights and biases. We already know from Part 1 that weights are what you multiply to inputs (e.g., the image pixels) before summing them together. We can add an extra number to this sum to shift things around and make the equations nicer. This extra number is called the “bias” term. As someone pointed out, this shouldn’t be confused with your K-pop bias. Extra reading.
Episode 5. Weights and biases.
  • We’ve already seen “epochs” before, which relates to the number of times that the neural network has seen the whole dataset. Usually, going over the whole dataset at once is too computationally intensive, so we chunk our operations in “batches”.
Episode 5. We do operations in batches, and train for several epochs.
  • Activation functions. After summing the weighted inputs and bias, this sum is actually squashed together to clamp the possible values between a minimum and maximum value for mathematical convenience. Values can be clamped between 0 and 1 (and be interpreted as probabilities) using the sigmoid as the mathematical operation. There are other options; for example, if you wanted the minimum to be -1 instead of 0, then the hyperbolic tangent function is a good fit.
Episode 5. There are options for activation functions, aside from the sigmoid.
  • Sigmoid and sigmoid prime. We’ve just mentioned the sigmoid function, usuallly written as the Greek letter sigma (σ). If you’ve checked the definition of the sigmoid, you can verify that the code below matches σ(x) = 1/(1 + exp(-x)). What about sigmoid prime? Recall Part 1, where we discussed how we want to get to the bottom of the loss curve by rolling against the incline. Other words used to refer to the incline are slope, gradient, and derivative. Generally, if you have some math function f(x) (read as “F of x”), the derivative is written as f’(x) (note the apostrophe after f). “F apostrophe” sounds too long, so it’s commonly read as “F prime”. So for the sigmoid function, “sigmoid prime” is its derivative, and by coincidence, conveniently turns out that σ’(x) = σ(x) * (1 — σ(x)), which you see in the code. More reading here and here.
Episode 5. You can verify that the sigmoid and its derivative match their corresponding definitions.

Those said, there were a couple of scenes that could raise some eyebrows:

  • In the face-off between Dalmi and Injae, they were using these boxes. Except those looked like Raspberry Pis (RPis), which are mini-computers and useful for home automation projects, but not really for AI. More likely candidates for AI embedded boards are from GPU makers, or companies that make custom AI hardware themselves. Sure, a case is a case, and maybe we can say that in Start-Up they had other hardware inside. Or I guess you really could try running neural networks on a Raspberry Pi — it will likely be slower, but I guess that’s the point. Yet another question is how easy it is to port a mobile app to a Raspberry Pi; let’s just say that they used a separate prototype and/or used the parts of the code that could run on a laptop and RPi, not necessarily the whole app per se. Or yeah, maybe they did go ahead and set up something like this.
Episode 11. That looks like a Raspberry Pi case.
Found a Raspberry Pi case online by searching. So yep, looks like a match. Link.
  • Then, there was the part where they had no backup code. Hard to imagine that the team of Dalmi and Injae really didn’t have backups for their code, even locally. Or maybe we can say that for security purposes they only had it on some remote-access servers? But still. I guess we can say that the twins really just screwed them up.
Episode 13. Twins are sus. Such impostors.
Episode 13. Same thoughts. No backups, really?

And that’s about it!

So overall, Start-Up was pretty well-researched. There were a few points of contention, but we could bridge those over a bit. Aside from the technical know-how, Start-Up also hit a few other aspects of AI, such as the experiences you would likely encounter when working in the field, as well as situations that could lead to a moral dilemma.

We already covered a lot so we can stop here, but if you’re ready for more, let’s wrap up in the third and final part of this series, which will be out next weekend! You can get updated when that comes out here.

If you’d like to go back to the first post, you can do so here.

Acknowledgments

Thanks to Lea for her suggestions and reviewing early drafts of this post.

Want more? Get personal email notifications for more stories like this, from tech and education to productivity and self-improvement.

Connect on Twitter, LinkedIn for more frequent, shorter updates, insights, and resources.

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI

Feedback ↓

Sign Up for the Course
`; } else { console.error('Element with id="subscribe" not found within the page with class "home".'); } } }); // Remove duplicate text from articles /* Backup: 09/11/24 function removeDuplicateText() { const elements = document.querySelectorAll('h1, h2, h3, h4, h5, strong'); // Select the desired elements const seenTexts = new Set(); // A set to keep track of seen texts const tagCounters = {}; // Object to track instances of each tag elements.forEach(el => { const tagName = el.tagName.toLowerCase(); // Get the tag name (e.g., 'h1', 'h2', etc.) // Initialize a counter for each tag if not already done if (!tagCounters[tagName]) { tagCounters[tagName] = 0; } // Only process the first 10 elements of each tag type if (tagCounters[tagName] >= 2) { return; // Skip if the number of elements exceeds 10 } const text = el.textContent.trim(); // Get the text content const words = text.split(/\s+/); // Split the text into words if (words.length >= 4) { // Ensure at least 4 words const significantPart = words.slice(0, 5).join(' '); // Get first 5 words for matching // Check if the text (not the tag) has been seen before if (seenTexts.has(significantPart)) { // console.log('Duplicate found, removing:', el); // Log duplicate el.remove(); // Remove duplicate element } else { seenTexts.add(significantPart); // Add the text to the set } } tagCounters[tagName]++; // Increment the counter for this tag }); } removeDuplicateText(); */ // Remove duplicate text from articles function removeDuplicateText() { const elements = document.querySelectorAll('h1, h2, h3, h4, h5, strong'); // Select the desired elements const seenTexts = new Set(); // A set to keep track of seen texts const tagCounters = {}; // Object to track instances of each tag // List of classes to be excluded const excludedClasses = ['medium-author', 'post-widget-title']; elements.forEach(el => { // Skip elements with any of the excluded classes if (excludedClasses.some(cls => el.classList.contains(cls))) { return; // Skip this element if it has any of the excluded classes } const tagName = el.tagName.toLowerCase(); // Get the tag name (e.g., 'h1', 'h2', etc.) // Initialize a counter for each tag if not already done if (!tagCounters[tagName]) { tagCounters[tagName] = 0; } // Only process the first 10 elements of each tag type if (tagCounters[tagName] >= 10) { return; // Skip if the number of elements exceeds 10 } const text = el.textContent.trim(); // Get the text content const words = text.split(/\s+/); // Split the text into words if (words.length >= 4) { // Ensure at least 4 words const significantPart = words.slice(0, 5).join(' '); // Get first 5 words for matching // Check if the text (not the tag) has been seen before if (seenTexts.has(significantPart)) { // console.log('Duplicate found, removing:', el); // Log duplicate el.remove(); // Remove duplicate element } else { seenTexts.add(significantPart); // Add the text to the set } } tagCounters[tagName]++; // Increment the counter for this tag }); } removeDuplicateText(); //Remove unnecessary text in blog excerpts document.querySelectorAll('.blog p').forEach(function(paragraph) { // Replace the unwanted text pattern for each paragraph paragraph.innerHTML = paragraph.innerHTML .replace(/Author\(s\): [\w\s]+ Originally published on Towards AI\.?/g, '') // Removes 'Author(s): XYZ Originally published on Towards AI' .replace(/This member-only story is on us\. Upgrade to access all of Medium\./g, ''); // Removes 'This member-only story...' }); //Load ionic icons and cache them if ('localStorage' in window && window['localStorage'] !== null) { const cssLink = 'https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css'; const storedCss = localStorage.getItem('ionicons'); if (storedCss) { loadCSS(storedCss); } else { fetch(cssLink).then(response => response.text()).then(css => { localStorage.setItem('ionicons', css); loadCSS(css); }); } } function loadCSS(css) { const style = document.createElement('style'); style.innerHTML = css; document.head.appendChild(style); } //Remove elements from imported content automatically function removeStrongFromHeadings() { const elements = document.querySelectorAll('h1, h2, h3, h4, h5, h6, span'); elements.forEach(el => { const strongTags = el.querySelectorAll('strong'); strongTags.forEach(strongTag => { while (strongTag.firstChild) { strongTag.parentNode.insertBefore(strongTag.firstChild, strongTag); } strongTag.remove(); }); }); } removeStrongFromHeadings(); "use strict"; window.onload = () => { /* //This is an object for each category of subjects and in that there are kewords and link to the keywods let keywordsAndLinks = { //you can add more categories and define their keywords and add a link ds: { keywords: [ //you can add more keywords here they are detected and replaced with achor tag automatically 'data science', 'Data science', 'Data Science', 'data Science', 'DATA SCIENCE', ], //we will replace the linktext with the keyword later on in the code //you can easily change links for each category here //(include class="ml-link" and linktext) link: 'linktext', }, ml: { keywords: [ //Add more keywords 'machine learning', 'Machine learning', 'Machine Learning', 'machine Learning', 'MACHINE LEARNING', ], //Change your article link (include class="ml-link" and linktext) link: 'linktext', }, ai: { keywords: [ 'artificial intelligence', 'Artificial intelligence', 'Artificial Intelligence', 'artificial Intelligence', 'ARTIFICIAL INTELLIGENCE', ], //Change your article link (include class="ml-link" and linktext) link: 'linktext', }, nl: { keywords: [ 'NLP', 'nlp', 'natural language processing', 'Natural Language Processing', 'NATURAL LANGUAGE PROCESSING', ], //Change your article link (include class="ml-link" and linktext) link: 'linktext', }, des: { keywords: [ 'data engineering services', 'Data Engineering Services', 'DATA ENGINEERING SERVICES', ], //Change your article link (include class="ml-link" and linktext) link: 'linktext', }, td: { keywords: [ 'training data', 'Training Data', 'training Data', 'TRAINING DATA', ], //Change your article link (include class="ml-link" and linktext) link: 'linktext', }, ias: { keywords: [ 'image annotation services', 'Image annotation services', 'image Annotation services', 'image annotation Services', 'Image Annotation Services', 'IMAGE ANNOTATION SERVICES', ], //Change your article link (include class="ml-link" and linktext) link: 'linktext', }, l: { keywords: [ 'labeling', 'labelling', ], //Change your article link (include class="ml-link" and linktext) link: 'linktext', }, pbp: { keywords: [ 'previous blog posts', 'previous blog post', 'latest', ], //Change your article link (include class="ml-link" and linktext) link: 'linktext', }, mlc: { keywords: [ 'machine learning course', 'machine learning class', ], //Change your article link (include class="ml-link" and linktext) link: 'linktext', }, }; //Articles to skip let articleIdsToSkip = ['post-2651', 'post-3414', 'post-3540']; //keyword with its related achortag is recieved here along with article id function searchAndReplace(keyword, anchorTag, articleId) { //selects the h3 h4 and p tags that are inside of the article let content = document.querySelector(`#${articleId} .entry-content`); //replaces the "linktext" in achor tag with the keyword that will be searched and replaced let newLink = anchorTag.replace('linktext', keyword); //regular expression to search keyword var re = new RegExp('(' + keyword + ')', 'g'); //this replaces the keywords in h3 h4 and p tags content with achor tag content.innerHTML = content.innerHTML.replace(re, newLink); } function articleFilter(keyword, anchorTag) { //gets all the articles var articles = document.querySelectorAll('article'); //if its zero or less then there are no articles if (articles.length > 0) { for (let x = 0; x < articles.length; x++) { //articles to skip is an array in which there are ids of articles which should not get effected //if the current article's id is also in that array then do not call search and replace with its data if (!articleIdsToSkip.includes(articles[x].id)) { //search and replace is called on articles which should get effected searchAndReplace(keyword, anchorTag, articles[x].id, key); } else { console.log( `Cannot replace the keywords in article with id ${articles[x].id}` ); } } } else { console.log('No articles found.'); } } let key; //not part of script, added for (key in keywordsAndLinks) { //key is the object in keywords and links object i.e ds, ml, ai for (let i = 0; i < keywordsAndLinks[key].keywords.length; i++) { //keywordsAndLinks[key].keywords is the array of keywords for key (ds, ml, ai) //keywordsAndLinks[key].keywords[i] is the keyword and keywordsAndLinks[key].link is the link //keyword and link is sent to searchreplace where it is then replaced using regular expression and replace function articleFilter( keywordsAndLinks[key].keywords[i], keywordsAndLinks[key].link ); } } function cleanLinks() { // (making smal functions is for DRY) this function gets the links and only keeps the first 2 and from the rest removes the anchor tag and replaces it with its text function removeLinks(links) { if (links.length > 1) { for (let i = 2; i < links.length; i++) { links[i].outerHTML = links[i].textContent; } } } //arrays which will contain all the achor tags found with the class (ds-link, ml-link, ailink) in each article inserted using search and replace let dslinks; let mllinks; let ailinks; let nllinks; let deslinks; let tdlinks; let iaslinks; let llinks; let pbplinks; let mlclinks; const content = document.querySelectorAll('article'); //all articles content.forEach((c) => { //to skip the articles with specific ids if (!articleIdsToSkip.includes(c.id)) { //getting all the anchor tags in each article one by one dslinks = document.querySelectorAll(`#${c.id} .entry-content a.ds-link`); mllinks = document.querySelectorAll(`#${c.id} .entry-content a.ml-link`); ailinks = document.querySelectorAll(`#${c.id} .entry-content a.ai-link`); nllinks = document.querySelectorAll(`#${c.id} .entry-content a.ntrl-link`); deslinks = document.querySelectorAll(`#${c.id} .entry-content a.des-link`); tdlinks = document.querySelectorAll(`#${c.id} .entry-content a.td-link`); iaslinks = document.querySelectorAll(`#${c.id} .entry-content a.ias-link`); mlclinks = document.querySelectorAll(`#${c.id} .entry-content a.mlc-link`); llinks = document.querySelectorAll(`#${c.id} .entry-content a.l-link`); pbplinks = document.querySelectorAll(`#${c.id} .entry-content a.pbp-link`); //sending the anchor tags list of each article one by one to remove extra anchor tags removeLinks(dslinks); removeLinks(mllinks); removeLinks(ailinks); removeLinks(nllinks); removeLinks(deslinks); removeLinks(tdlinks); removeLinks(iaslinks); removeLinks(mlclinks); removeLinks(llinks); removeLinks(pbplinks); } }); } //To remove extra achor tags of each category (ds, ml, ai) and only have 2 of each category per article cleanLinks(); */ //Recommended Articles var ctaLinks = [ /* ' ' + '

Subscribe to our AI newsletter!

' + */ '

Take our 85+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

'+ '

Towards AI has published Building LLMs for Production—our 470+ page guide to mastering LLMs with practical projects and expert insights!

' + '
' + '' + '' + '

Note: Content contains the views of the contributing authors and not Towards AI.
Disclosure: This website may contain sponsored content and affiliate links.

' + 'Discover Your Dream AI Career at Towards AI Jobs' + '

Towards AI has built a jobs board tailored specifically to Machine Learning and Data Science Jobs and Skills. Our software searches for live AI jobs each hour, labels and categorises them and makes them easily searchable. Explore over 10,000 live jobs today with Towards AI Jobs!

' + '
' + '

🔥 Recommended Articles 🔥

' + 'Why Become an LLM Developer? Launching Towards AI’s New One-Stop Conversion Course'+ 'Testing Launchpad.sh: A Container-based GPU Cloud for Inference and Fine-tuning'+ 'The Top 13 AI-Powered CRM Platforms
' + 'Top 11 AI Call Center Software for 2024
' + 'Learn Prompting 101—Prompt Engineering Course
' + 'Explore Leading Cloud Providers for GPU-Powered LLM Training
' + 'Best AI Communities for Artificial Intelligence Enthusiasts
' + 'Best Workstations for Deep Learning
' + 'Best Laptops for Deep Learning
' + 'Best Machine Learning Books
' + 'Machine Learning Algorithms
' + 'Neural Networks Tutorial
' + 'Best Public Datasets for Machine Learning
' + 'Neural Network Types
' + 'NLP Tutorial
' + 'Best Data Science Books
' + 'Monte Carlo Simulation Tutorial
' + 'Recommender System Tutorial
' + 'Linear Algebra for Deep Learning Tutorial
' + 'Google Colab Introduction
' + 'Decision Trees in Machine Learning
' + 'Principal Component Analysis (PCA) Tutorial
' + 'Linear Regression from Zero to Hero
'+ '

', /* + '

Join thousands of data leaders on the AI newsletter. It’s free, we don’t spam, and we never share your email address. Keep up to date with the latest work in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

',*/ ]; var replaceText = { '': '', '': '', '
': '
' + ctaLinks + '
', }; Object.keys(replaceText).forEach((txtorig) => { //txtorig is the key in replacetext object const txtnew = replaceText[txtorig]; //txtnew is the value of the key in replacetext object let entryFooter = document.querySelector('article .entry-footer'); if (document.querySelectorAll('.single-post').length > 0) { //console.log('Article found.'); const text = entryFooter.innerHTML; entryFooter.innerHTML = text.replace(txtorig, txtnew); } else { // console.log('Article not found.'); //removing comment 09/04/24 } }); var css = document.createElement('style'); css.type = 'text/css'; css.innerHTML = '.post-tags { display:none !important } .article-cta a { font-size: 18px; }'; document.body.appendChild(css); //Extra //This function adds some accessibility needs to the site. function addAlly() { // In this function JQuery is replaced with vanilla javascript functions const imgCont = document.querySelector('.uw-imgcont'); imgCont.setAttribute('aria-label', 'AI news, latest developments'); imgCont.title = 'AI news, latest developments'; imgCont.rel = 'noopener'; document.querySelector('.page-mobile-menu-logo a').title = 'Towards AI Home'; document.querySelector('a.social-link').rel = 'noopener'; document.querySelector('a.uw-text').rel = 'noopener'; document.querySelector('a.uw-w-branding').rel = 'noopener'; document.querySelector('.blog h2.heading').innerHTML = 'Publication'; const popupSearch = document.querySelector$('a.btn-open-popup-search'); popupSearch.setAttribute('role', 'button'); popupSearch.title = 'Search'; const searchClose = document.querySelector('a.popup-search-close'); searchClose.setAttribute('role', 'button'); searchClose.title = 'Close search page'; // document // .querySelector('a.btn-open-popup-search') // .setAttribute( // 'href', // 'https://medium.com/towards-artificial-intelligence/search' // ); } // Add external attributes to 302 sticky and editorial links function extLink() { // Sticky 302 links, this fuction opens the link we send to Medium on a new tab and adds a "noopener" rel to them var stickyLinks = document.querySelectorAll('.grid-item.sticky a'); for (var i = 0; i < stickyLinks.length; i++) { /* stickyLinks[i].setAttribute('target', '_blank'); stickyLinks[i].setAttribute('rel', 'noopener'); */ } // Editorial 302 links, same here var editLinks = document.querySelectorAll( '.grid-item.category-editorial a' ); for (var i = 0; i < editLinks.length; i++) { editLinks[i].setAttribute('target', '_blank'); editLinks[i].setAttribute('rel', 'noopener'); } } // Add current year to copyright notices document.getElementById( 'js-current-year' ).textContent = new Date().getFullYear(); // Call functions after page load extLink(); //addAlly(); setTimeout(function() { //addAlly(); //ideally we should only need to run it once ↑ }, 5000); }; function closeCookieDialog (){ document.getElementById("cookie-consent").style.display = "none"; return false; } setTimeout ( function () { closeCookieDialog(); }, 15000); console.log(`%c 🚀🚀🚀 ███ █████ ███████ █████████ ███████████ █████████████ ███████████████ ███████ ███████ ███████ ┌───────────────────────────────────────────────────────────────────┐ │ │ │ Towards AI is looking for contributors! │ │ Join us in creating awesome AI content. │ │ Let's build the future of AI together → │ │ https://towardsai.net/contribute │ │ │ └───────────────────────────────────────────────────────────────────┘ `, `background: ; color: #00adff; font-size: large`); //Remove latest category across site document.querySelectorAll('a[rel="category tag"]').forEach(function(el) { if (el.textContent.trim() === 'Latest') { // Remove the two consecutive spaces (  ) if (el.nextSibling && el.nextSibling.nodeValue.includes('\u00A0\u00A0')) { el.nextSibling.nodeValue = ''; // Remove the spaces } el.style.display = 'none'; // Hide the element } }); // Add cross-domain measurement, anonymize IPs 'use strict'; //var ga = gtag; ga('config', 'G-9D3HKKFV1Q', 'auto', { /*'allowLinker': true,*/ 'anonymize_ip': true/*, 'linker': { 'domains': [ 'medium.com/towards-artificial-intelligence', 'datasets.towardsai.net', 'rss.towardsai.net', 'feed.towardsai.net', 'contribute.towardsai.net', 'members.towardsai.net', 'pub.towardsai.net', 'news.towardsai.net' ] } */ }); ga('send', 'pageview'); -->