emotion or drive is not stronger you're not gonna do anything to get out of it what's up guys this era coherence national speaker entrepreneur and best-selling author and in this video I'll break down for you the three keys to make the secret work for you finally while I relax on this chair love it so much so we're gonna get straight into it the first thing using the law of


attraction is we must visualize and this what the secret talks about but you know just visualizing alone is really not going to be able to allow the manifestation to work for you the biggest problem is is because there's a lot of that goes on through the day so let's say for example you spend I don't know three minutes five minutes visualizing in the morning the rest of

Why 'The Secret' Wonâ€™t Work For You Until You Do This.. [Law of Attraction]


the day you're visualizing something else so what that means is it kind of like puts us in a position where we're manifesting everything that we don't want and the small time and energy that we put into what we do want isn't manifesting first so what is the solution the solution is to understand a step number two and step number two is the principle of the law of attraction


we have Canada here say hi the principle of the law of attraction is to understand that it's all based around emotions the more you are able to magnify your emotions what happens is a speeds the whole law of attraction of but aside from that it makes it much much more powerful because vibrations if you think about it when you are very very emotionally charged up your


vibration is kind of raised to a crazy crazy crazy vibrational frequency and the more crazy it is the more it sets it in there so even if you just do it for three minutes five minutes in the morning hold stronger vibrations than your whole entire day so it's all about the second part raising those emotions and really getting into the group so step number one is to actually visualize that number


two is to really amplify the emotions as if you're living it right now and finally step number three Aires with that step number three is the most important part at all which is to let go now you're thinking what do you mean like let go I think a lot of people recently have been getting really really confused when I say set it and forget it that's what I write about in my book


they say Eric if I said it when do I said it how long do I sell it for when do I let it go what's the balance between setting it and forgetting it well actually you said it early on in the morning when you're most at peace the rest of the time you've got to have trust I was doing this call yesterday for the whole superphone thing I know a lot of you a lot of you have been


texting me over the last couple of days and I am receiving your messages by the way it's just like there's thousands and thousands of thousands of requests coming in so it's very hard to actually reply to you all however one of the biggest questions that I keep getting from a lot of you is when you said it when do you forget it and also how do you actually trust the universe what if


you have a lot of doubt happening within you because if there's doubt it's very hard to make the Law of Attraction work for you so the whole idea of it what I was teaching yesterday during the live call was that you need to get this into your head and I want you to type this in the comments below those of you who are new to this channel we always type our learnings below to reaffirm the learning


Who am I not to trust I've run my whole life based on this very very simple concept Who am I not to trust if you understand we were all created by something that's greater than us much powerful force a much magical force you can call it God you can name it the universe you can name it whatever you want to name it but we can't deny that thing exists now if that thing exists


who are we not to trust it has the decision to put you into this world when it wants to and it also has the decision to take you away and sometimes think about it how many times throughout your life so far have you felt totally out of control you don't know how to handle it you don't know how to deal with the situation and you felt so so challenged and you were


just stuck but somehow you pulled through and that magic happened so if it's ever happened to you before whether in relationships and business and finances whatever it is then if nothing actually happened before who are you not to trust because it always always the universe always always has your back and if you understand that and have that peace of mind then when you have that


peace of mind everything starts shifting and Wow we start shifting we don't need to play your song I'm gonna play your song it's beautiful so I'm ready I made it for too long have you played [Music] a prize for whoever guesses what the song is called you can comment below anyway guys I'm gonna finish off for today because we have to go up to Newcastle with ah okay you know where


are you because today is dad's birthday so I'm a blog along the way I don't know it depends if we have enough time to do so but anyway guys if this video has been of any use to you whatsoever you know what to do hit that thumbs up hit the like button also comment below let us know where you guys have tuned in from and finally if you're new to this channel and have been any used to you


hi-yah thanks a lot for joining us today thank you for inviting me actually I was glad to be here yeah one of the world's most visible deep learning researchers life asked me to share a bit about your personal story so how do you end up doing this work that you now do yeah that sounds great I guess I first became interested in machine learning right before I met you actually I've been

Heroes of Deep Learning: Andrew Ng interviews Ian Goodfellow


working on neuroscience and my undergraduate adviser Jerry Kane a Stanford encouraged me to take your internet AI class I didn't know that okay so I had always thought that AI was a good idea but that in practice the main thing I knew that was happening was like game AI where people have a lot of hard-coded rules for non player characters and games to say different


scripted lines at different points in time and then when I took you were injured AI class and you covered topics like linear regression and the bias and various variants decomposition of the error linear regression I started to realize that this is a real science and I could actually have a scientific career in AI rather than nursing great and then what happe well I came back an


IT a two-year course I'm late I see great education so the really big turning point for me was while I was teeing that course one of the students my friend Ethan Dreyfus got interested in geoff hinton deep belief that paper and the two of us ended up building one of the first GPU CUDA based machines at Stanford in order to run Boulton machines in our spare time over winter


break and at that point I started to have a very strong intuition that deep learning was the way to go in the future that a lot of the other algorithms I was working with like support vector machines didn't seem to have the right asymptotics that you add more training data and it gets lower or for the same amount of training data it's hard to make them perform a lot better by


changing other settings and at that point I I started to focus on deep learning as much as possible indeed and remember Magette rain has very old GPU paper race acknowledges you for having done a lot already work yeah yeah as I was written using some of the missions that we built the first machine I built was just something that Ethan and I built that Ethan's mom's house


that I would wait with our own money and then later we have money to build the first to agree for the Stanford lab wow that's great I never knew that story of Jason oh and then today one of the you know things that's really taken the deepening world by storm is you invention of Gans so how did you come up with that I just studying generative models for a long time sort of a Gans


our way of doing generative modeling where you have a lot of training data and you'd like to learn to produce more examples that resemble the training data but but they're imaginary they've never been seen exactly in that form before there were several other ways of doing generative models that had been popular for several years before I had the idea for again and after I've been working on


all those other methods throughout most of my PhD I knew a lot about the advantages and disadvantages of all the other frameworks like Bolton machines and sparse coding and all the other approaches that had been really popular for years I was looking for something how to avoid all of those disadvantages at the same time and then finally when I was arguing about 200 models with my


friends in a bar something clicked into place and I started telling them you need to do this this and this and I swear it'll work and my friends didn't believe me that it would work I was supposed to be writing the deep learning text book at the time but I believed strongly enough that it would work that I went home and coded it up the same night that it worked


so thank you one evening to implement the first version as I if I implemented it around midnight after going home from the bar where my friend's house is going-away party and the first version of it worked which is very very fortunate I didn't have to search for hyper parameters or anything it was just for me I read it somewhere where you had a deaf experience and that reaffirm your


commitment to AI tell me that yeah I was I wasn't actually near deaf but I briefly thought that I was I had a very bad headache and some of the doctors thought I might have a brain hemorrhage and during the time that I was waiting for my MRI results to find out whether I had a brain hemorrhage or not I realized that most of the fact I was having worry about making sure that other people


would eventually try out the research ideas that I had at the time in retrospect they're all pretty silly research ideas but at that point I realized that this was actually one of my highest priorities in life was carrying out my machine learning research work yeah that's great that when you thought you might be dying soon you're just thinking how we get the


research done yeah yeah that that that that's commitment yes yeah so today you're still at the center of allow the activities with scans of generative atmosphere networks so tell me how you see the future of Gans right now Jen's are used for a lot of different things like so my supervised learning generating training data for other models and even simulating scientific


experiments in principle all of these things could be done but other kinds of generative models so I think that games are at an important crossroads right now right now they work well some of the time but it can be more of an art than a science to really bring that performance out of them it was more or less how people felt about deep learning in general 10 years ago and back then we


were using deep belief networks with bolts and machines as a building blocks they were very very finicky over time we switched to think like rectified linear units and Bachelor realization and deep learning became a lot more reliable if we can make games become as reliable as deep learning has become but I think we'll keep seeing games used in all the places they're used


with much greater success if we aren't able to figure out how to stabilize games but I think their main contribution to the history of deep learning is that they will have shown people how to do all these tasks that involve generative modeling and eventually we will replace them with other forms of generative models so I spend maybe about 40% of my time right


now working on stabilizing games he's cool oh and so just as a lot of people they join deep learning about ten years ago such as itself ended up being pioneers maybe the people they joined Gans today if it works out could end up the early pioneers yeah a lot of people already are early pioneers of games and I think if you wanted to give any kind of history of again so far you'd really


need to mention other groups like indigo and Facebook and Berkeley for all the different things that they've done so in addition to all your research you also co-authored a book on these learnings oh that guy that's right with Joshua Benji oh and Aaron kohrville who were my PhD coat visors we wrote the first textbook on the modern version of deep learning and that has been very popular both in


the English edition and the Chinese Edition we sold about I think around 70,000 copies total between those two languages and I've had a lot of feedback from students who said that they've learned a lot from it one thing that we did a little bit differently than some other books is we start with a very focused introduction to the kind of math that you need to do deep learning I


think one thing that I got from your courses at Stanford is the linear algebra and probability are very important that people get excited about the machine learning algorithms but if you want to be a really excellent practitioner you've got to master the basic math that underlies the whole approach in the first place so we make sure to give a very focused presentation


of the basics that's a start book that way you don't need to go ahead and learn all of linear algebra but you can get a very quick crash course in the piece of the linear algebra that are the most useful for deep learning so even someone whose math you know is real shaky you've ever seen in math for a few years we're going to start from the beginning of your book


and get that background and get into deep learning all of the facts that you would need to know are there it would definitely take some focused efforts and practice that making use of them great if someone's really afraid of method it might be a bit of a painful experience but but if you're ready for the learning experience and you believe you can master it I think all the all the tools


that you need are there as someone does work in designing for a long time I'd be curious if you look back over the years tell me about how about how you're thinking of AI and a deep learning has evolved over the years ten years ago I felt like as a community the biggest challenge in machine learning was just how to get it working for AI related tasks at all we have really good tools


that we can use for simpler tasks where we wanted to recognize patterns in hand extracted features where a human designer could do a lot of the work by creating those features and then hand it off to the computer and that was really good for different things like predicting which adds the user would click on or different kinds of basic scientific analysis but we really


struggled to do anything involving millions of pixels in an image or a raw audio waveform where the system hasn't built all of its understanding from scratch we finally got over the hurdle really thoroughly maybe five years ago and now we're at a point where there are so many different paths opens that someone who wants to get involved in AI may be the hardest problem they face is


choosing which path they want to go down do you want to make reinforcement learning work as well as supervised learning works do you want to make unsupervised learning work as well as supervised works do you want to make sure that machine learning algorithms are fair and reflect biases that we prefer to avoid do you want to make sure that the societal issues surrounding AI work out


well that we are able to make sure that a AI benefits everyone rather than causing social of people and trouble with lots of jobs I think right now this is really an amazing amount of different things it can be done both to prevent downsides from AI but also to make sure that we leverage all of the upsides that it offers us and so today there are a lot of people wanting to get into AI so


what advice would you have for someone like that I think a lot of people that want to get into a I start thinking that they absolutely need to get a PhD or some other kind of credential like that I don't think that's actually a requirement anymore one way that you could get a lot of attention is to write good code and put it on github if you have an interesting project that solves


the problem that someone working at the top lab one is itself once they find your github repositories they'll come find you and ask you to come work there a lot of the people that I've hired or recruited at opening I last year or at Google this year I first became interested in working with them because it's something that I saw that they released in open-source form on the


internet writing papers and putting them in archives can also be good a lot of the time it's harder to reach the point where you have something polished enough to really be a new academic contribution to the scientific literature but you can often get to the point of having a useful software product much earlier so sort of you know Nietzsche book practices and materials and post like


github and maybe on archive I think if you if you learn by reading the book it's really important to also work on a project at the same time to either choose some way of applying machine learning to an area that you're already interested in like if you're a field biologist and you want to deep-learning maybe you could use it to identify birds or if you don't have an


idea for how you'd like to use machine learning in your own life you could pick something like making a tree view house numbers classifier where all the data sets are set up to make it very straightforward for you and that way you get to exercise all of the basic skills while you read the book or while you watch Coursera videos that explains the concepts to you so over the last couple


years have also seen you do one will work on adversarial examples and tell us a bit about that yeah I think every searle examples are the beginning of new fields that I called machine learning security in the past we've seen computer security issues where attackers could fool a computer into running the run code that's called application level security and there's been attacks where


people can fool a computer into believing that messages on a network come from somebody that is not actually who they says they say they are and that's called Network level security now we're starting to see that you can also fool machine learning algorithms into doing things they shouldn't even if the program running the machine learning algorithm is running the correct code


even if the program running the machine learning algorithm knows who all the messages on the network really came from and I think it's important to build security into a new technology near the start of its development we found that it's very hard to build a working system first and then add security later so I am really excited about the idea that if we dive in and start anticipating


security problems with machine learning now we can make sure that these algorithms are secure from the start instead of trying to patch it in richer actively years later thank you fellas great there's a lot about your story that I thought was fascinating and that despite having known you for years I didn't actually know so thank you for sharing all that oh very welcome thank


from the amazing results and vintage Atari games deep Minds victory with alphago stunning breakthroughs in robotic arm manipulation and even beating professional players at 1v1 dota the field of reinforcement learning has literally exploded in recent years ever since the impressive breakthrough on the imagenet classification challenge in 2012 the successes of supervised deep

An introduction to Reinforcement Learning


learning have continued to pile up and people from many different backgrounds have started using deep neural nets to solve a wide range of new tasks including how to learn intelligent behavior in complex dynamic environments so in this episode I will give a general introduction into the field of reinforcement learning as well as an overview of the most challenging


problems that we're facing today if you're looking for a solid introduction into the field of deep reinforcement learning then this episode is exactly what you're looking for my name is Xander and welcome to archive insights [Laughter] [Music] [Music] so in its 2017 Peter Emil gave a very inspiring demo in front of a large audience of some of the brightest minds


in AI and machine learning so you showed this video where a robot is cleaning a living room bringing somebody a bottle of beer and basically doing a whole range of mundane tasks that robots in sci-fi movies can do without question and then at the end of the video peter revealed that the robots actions were actually entirely remote-controlled by a human operator and the takeaway from


this demo I think is a very important one it basically says that the robots we've been building for decades now are physically perfectly capable of doing a wide range of useful tasks but the problem is that we can't embed them with the needed intelligence to do those things so basically creating useful state-of-the-art robotics is a software challenge and not a hardware problem and


so it turns out that having a robot learn how to do something very simple like picking up a bottle of beer can be a very challenging task and so in this video I want to introduce you guys to the whole subfield in machine learning that's called reinforcement learning which i think is one of the most promising directions to actually get to very intelligent robotic behavior so in the most common


machine learning applications people use what we call supervised learning and this means that you give an input to your neural network model but you know the output that your model should produce and therefore you can compute gradients using something like the back propagation algorithm to train that network to produce your outputs so imagine you want to train a neural


network to play the game of pong what you would do in a supervised setting is you would have a good human gamer play the game of pong for a couple of hours and you would create a data set where you log all of the frames that that human is seeing on the screen as well as the actions that he takes in response to those frames so whatever is pushing the up arrow or the down arrow and we can


then feed those input frames through a very simple neural network that at the output can produce two simple actions it's either going to select the up action or the down action and by simply training on the data set of the human gameplay using something like back propagation we can actually train that neural network to replicate the actions of the human gamer but there are two


significant downsides to this approach so on the one hand if you want to do supervised learning you have to create a data set to train on which is not always a very easy thing to do and on the other hand if you train your neural network model to simply imitate the actions of the human player well then by definition your agent can never be better at playing the game of pong than that human


gamer for example if you want to train a neural net to be better at playing the game of gold and the best human then by definition we can't use supervised learning so is there a way to have an agent learn to play a game entirely by itself well fortunately there is and this is called reinforcement learning so the framework and reinforcement learning is actually surprisingly similar to the


normal framework in supervised learning so we still have an input frame we run it through some neural network model and the network produces an output action we either up or down but the only difference here is that now we don't actually know the target label so we don't know in any situation whether we should have gone up or down because we don't have a data set to train on and in


reinforcement learning the network that transforms input frames to output actions is called the policy Network now one of the simplest ways to train a policy network is a method called policy gradients so the approach in policy gradients is that you start out with a completely random network you feed that network a frame from the game engine it produces a random up with action you know either up


or down you send that action back to the game engine and the game engine produces the next frame and this is how the loop continues and the network in this case it could be a fully connected network but you can obviously apply convolutions there as well and now in reality the output of your network is going to consist of two numbers the probability of going up and the probability of going


down and what you will do while training is actually sample from the distribution so that you're not always going to repeat the same exact actions and this will allow your agent to sort of explore the environment a bit randomly and hopefully discover better rewards and better behavior now importantly because we want to enable our agent to learn entirely by itself the only feedback


that we're gonna give it is the scoreboard in the game so whenever our agent manages to score a goal it will receive a reward of +1 and if the opponent scored a goal then our agent will receive a penalty of minus 1 and the entire goal of the agent is to optimize its policy to receive as much reward as possible so in order to train our policy network the first thing we're


gonna do is collect a bunch of experience so you're just gonna run a whole bunch of those game frames through your network select random actions feed them back into the engine and just create a whole bunch of random pong games and now obviously since our agent hasn't learned anything useful yet it's gonna lose most of those games but the thing is that sometimes our agent might


get lucky sometimes it's going to randomly select a whole sequence of actions that actually lead to scoring a goal and in this case our agent is going to receive a reward and a key thing to understand is that for every episode regardless of whether we want a positive or a negative reward we can already compute the gradients that would make the actions that our agents has chosen


more likely in the future and this is very crucial and so what policy gradients are going to do is that for every episode where we've got a positive reward we're going to use the normal gradients to increase the probability of those actions in the future but whenever we got a negative we're gonna apply the same gradient but we're gonna multiply it with minus one


and this minus sign will make sure that in the future all the actions that we took in a very bad episode are going to be less likely in the future and so the result is that while training our policy network the actions that lead to negative rewards are slowly going to be filtered out and the actions that leads to positive rewards are going to become more and more likely so in a sense our


agent is learning how to play the game of pong now I know this was a very quick introduction to reinforcement learning so if you want to read up a bit and spend a little bit more time in thinking about the details I really recommend to read and rake carpet these blog post pong from pixels it does a phenomenal job at explaining all the details all right so we can use


policy gradients to train a neural network to play the game of pong that's amazing right well yes it is but as always there are a few very significant downsides to using this methods let's go back to pong one more time so imagine that your agent has been training for a while and it's actually doing a pretty decent job at playing the game of pong it's bouncing the ball back and forth


but then at the end of the episode it makes a mistake it lets the ball through and it gets a negative penalty so the problem with policy gradients is that our policy gradient is going to assume that since we lost that episode all of the actions that we took there must be bad actions and is going to reduce the likelihood of taking those actions in the future but remember that actually


the most part of that episode we were doing really well so we don't really want to decrease the likelihood of those actions and in reinforcement learning this is called the credit assignment problem it's where if you get a reward at the end of your episode well what are the exact actions that led to that specific reward and this problem is entirely related to the fact that we have what we


call a sparse reward setting so instead of getting a reward for every single action we only get a reward after an entire episode and our agent needs to figure out what part of its action sequence we're causing the reward that it eventually gets so in the case of punk for example our agent should learn that it's only the actions right before it hits the ball that are truly


important everything else once the ball is flying off it doesn't really matter for the eventual reward and so the result of this sparse reward setting is that in reinforcement learning algorithms are typically very sample inefficient which means that you have to give them a ton of training time before they can learn some useful behavior and I've made a previous video to compare


the sample efficiency of reinforcement learning algorithms with human learning that goes much deeper into why this is the case and now it turns out that in some extreme cases the sparse reward setting actually fails completely so a famous example is the game Montezuma's Revenge where the goal of the agent is to navigate a bunch of ladders jump over a skull grab a key and then actually


navigate to the door - in order to get to the next level and the problem here is that by taking random actions your agent is never gonna see a single reward because you know the sequence of actions that it needs to take to get that reward is just too complicated it's never gonna get there with random actions and so your policy gradient is never gonna see a single positive reward so it has no


idea what to do in the same case applies to robotic control where for example you would like to train in robotic arm to pick up an object and stack it onto something else well the typical robot has about seven joints that it can move so it's a relatively high action space and if you only give it a positive reward when it's actually successfully stacked a block


well by doing random exploration it's never gonna get to see any of that reward and I think it's important to compare this with the traditional supervised deep learning successes that we get into something like computer vision for example so the reason computer vision works so well is that for every single input frame you have a target label and this lets you do very


efficient gradient descent with something like back propagation whereas in a reinforcement learning setting you're having to deal with this very big problem of sparse reward setting and this is why you know computer vision is showing some very impressive results while something is simple as stacking one block onto another seems very difficult even for state-of-the-art woodland


[Music] and so the traditional approach to solve this issue of sparse rewards has been the use of rewards shaping so reward chipping is the process of manually designing a reward function that needs to guide your policy to some desired behavior so in the case of montezuma's revenge for example you could give your agent a reward every single time it manages to avoid the skull or reach the


key and these extra rewards will guide your policy to some desired behavior and while this obviously makes it easier for your policy to converge to desired behavior there are some significant downsides to reward shaping so firstly reward shaping is a custom process that needs to be redone for every new environment you want to train a policy so if you're looking at the benchmark of


Atari for example well you would have to craft a new reward function for every single one of those games that's just not scalable the second problem is that we Ward shaping suffers from what we call the alignment problem so it turns out that reward shaping is actually surprisingly difficult in a lot of cases when you when you shape your reward function your agent will find some very


surprising way to make sure that it's getting a lot of reward but not doing at all what you wanted to do and in a sense the policy is just overfitting to that specific reward function that you designed while not generalizing to the intended behavior that you had in mind and there's a lot of funny cases where reward shaping goes terribly wrong so here for example the agent was trained


to do jumping and the reward function was the distance from its feet to the ground and what this agent has learned is to simply grow a very tall body and do some kind of a backflip to make sure that its feet are very far from the ground to give you one final idea of how hard it can be to the reward shaping I mean look at this shaped reward function for a robotic control task I don't even


want to know how long the people from this paper spent on designing this specific reward function to get the behavior that they wanted and finally in some cases like alphago for example by definition you don't want to do any reward shaping because this will constrain your policy to the behavior of humans which is not exactly optimal in every situation so the situation that


we're in right now is that we know that it's really hard to train in a sparsely setting but at the same time it's also very tricky to shape a reward function and we don't always want to do that and to end this video I would like to note that a lot of media stories picture reinforcement learning as some kind of a magical AI sauce that lets the agent learn on itself or improve upon its


previous version but the reality is that most of these breakthroughs are actually the work of some of the brightest minds alive today and there's a lot of very hard engineering going on behind the scenes so I think that one of the biggest challenges in navigating our digital landscape is discerning truth from fiction in this ocean of clickbait that is powered by the advertisement


industry and I think the Atlas robot from Boston Dynamics is a very clear example of what I mean so I think if you go out on the streets and you ask a thousand people with the most advanced robots today are well they would probably point to Atlas from Boston Dynamics because everybody has seen the video where it does a backflip but the reality is that if you think about


what's what Boston Dynamics is actually doing well it's very likely that there's not a lot of deep learning going on there if you look at their previous papers in the research track record well they're they're doing a lot of very advanced robotics don't get me wrong but there's not a lot of self driven behavior there's not a lot of intelligent decision-making going on in


those robots so don't get me wrong Boston Dynamics is a very impressive robotics company but the media images they've created might be a little bit confusing to a lot of people that don't know what's going on behind the scenes but nonetheless if you look at the progress of research that is going on I think we should not be negligible of the potential risks that these technologies


can bring so I think it's very good that a lot more people are getting involved in the whole a AI safety research because this is going to become very fundamental threats like autonomous weapons and mass surveillance are to be taken very seriously and so the only hope we have is that international law is going to be somewhat able to keep up with the rapid progress we see in


technology but on the other hand I also feel like the media is focusing way too much on the negative side of these technologies simply because people fear what they don't understand and well fear sells more advertisement than utopias so I personally believe that most if not all technological progress is beneficial in the long run as long as we can make sure that there


are no monopolies that can maintain or enforce their power with the malignant use of AI well anyway enough politics for one video so this video was an introduction into deep reinforcement learning and an overview of the most challenging problems that we're facing in the field in the next video I will dive into some of the most recent approaches that try to tackle these


problems of sample efficiency and the sparse reward setting so specifically I will cover a few technical papers dealing with approaches like auxilary or reward settings intrinsic curiosity hindsight experience replay and so on I've also seen that a few people have chosen to support me on patreon for which I would just like to say thank you very much I mean it really means a big


[Music] so hi everyone uh i am glad to have to have a chance to give this talk to you today uh so as dragon already mentioned uh the title is api design uh tips and uh introduction into building the apis uh so thinking about this topic uh uh it's in this talk it's it will not be a matter of uh talking about one correct approach uh as uh there are many good ones

API Design - Getting Started—Alen Pokos


uh the goal is stop is to talk about the ideas and thought process and how you can use those when designing and thinking about uh apis uh the talk will not cover the whole topic because uh this is a very very big area to talk about uh so i will uh focus on some of the selected areas that i found in my experience to be the most available when thinking about the api

API Design - Getting Started—Alen Pokos


design examples shown in this stock are inspired by real life uh some of which are simplified or adjusted to fit the format of this talk first let me let me introduce myself to you as dragon already mentioned my name is allen i'm a deputy cto and team leader of architecture team at decoder i've been building web apps and apis for a very long time now i've been building json api powered

API Design - Getting Started—Alen Pokos


projects for the past five years i'm doing talks training workshops and educations as part of my daily work let me talk about a little bit about our company so three coder is a company based in zagreb croatia and we employ uh developers uh uh on premise and remote also from uh some uh neighboring countries uh we are medium company with 65 employees out of which

API Design - Getting Started—Alen Pokos


50 are developers and engineers so we cover mobile front and back and data science ux and ui uh our main project is uh nuscolo it's a classified platform which is number one in oh sorry do you see it now ah okay yeah sorry there was a miss in the shires uh okay uh so we have a uh our main project is a new scholar uh it's number one uh platform in croatia and uh also in slovenia

API Design - Getting Started—Alen Pokos


and we are always open to hire uh new colleagues so feel free to check out our website for more information uh on to the topic so uh when we talk about the apis uh uh depending on your technical background uh the api can uh mean several different things so let's try to clear up uh this definition first so uh in our definition apis uh is something that enables

API Design - Getting Started—Alen Pokos


application to communicate with one another uh this can be either uh server to server a client application or some other service that you are building so a well designed api should reflect the goals of business and it's designed to serve that purpose the idea here where will talk about is uh web apis but the ideas and thoughts are also applicable to other areas as well

API Design - Getting Started—Alen Pokos


uh so when talk about uh talking about the web apis we need to mention uh restful apis uh so it's an architectural style for uh building distributed systems based on hyper media and it's not necessarily just implying uh http uh so web apis is what we will talk about today a couple of things to mention here uh web is usually a stateless request model using http and the http requests should

API Design - Getting Started—Alen Pokos


be independent of each other and may occur in any order uh this is something when uh thinking about the how we will model our uh endpoints so uh why we use apis uh so apis are used to build uh webs to build for other web servers or client consumers such as web browser mobile application uh outside services uh one thing that we can also uh usually imply its communication is

API Design - Getting Started—Alen Pokos


done using http protocol in some text formats most preferably json or xml so before we dive into the apis we can also talk about the design world design world itself can have several meanings and one definition that i found very useful is design is a set of decisions with the goal to define the look and functionality of the topic that you are designing uh so

API Design - Getting Started—Alen Pokos


it's a simple but valuable definition that can help us understand when we talk about the design so uh what does this mean in a sense of api design so uh api design is a process of developing uh interfaces for exposing our functionality or data to other applications as such a good api design takes into consideration organization specific strengths uh and uh limitations in terms of

API Design - Getting Started—Alen Pokos


budgets personal skills and technical uh infrastructure so i said here we need to think about also the technical approach but also take into account the consumers and our business that we are trying to support here uh one thing that we uh often uh come into across in our experience when talking about the api design is uh when people disagree on design it's often they don't agree on the goals and

API Design - Getting Started—Alen Pokos


in my experience this is one of the very important notes to have in your head so because a lot of times the discussions is about the design but we need to consider uh what what is our goal uh so for example if there is a disagreement that the current design is not future proof for the next five to ten years uh but our goal is to deliver some short-lived feature

API Design - Getting Started—Alen Pokos


then this discussion is not needed because it's not our goal we are delivering something that has a shelf life and uh very often in our uh in our area of work uh our solutions have a shelf life because we are always thinking about how to upgrade them so when talking about the design a good design can be broken down into three main aspects those are purpose usability

API Design - Getting Started—Alen Pokos


and constraints uh so a purpose part uh as we mentioned in the previous slides uh is about fulfilling the business goals about getting the right information uh to the right side uh usability and constraints this again can be also covered depending on your technology stack and standards you could already have this covered with some standard that you use so for example in recorder we use a json

API Design - Getting Started—Alen Pokos


api standard which i'll mention later in the talk and also give some examples and this helped us a lot to really think about the important stuff and not to worry about conventions and similar so to summarize what is the api responsibilities it's to provide the data and functionality to successfully complete a business goal uh that business goal can be a sale a

API Design - Getting Started—Alen Pokos


conversion a technology related data exchange anything that you are trying to cover one also uh interesting uh thought to have is i think everyone here some variation of this is uh good solutions have strong foundations uh so when thinking about the api design uh there is a way that i can actually try to visualize this so looking at our solution we built a solution to fulfill some

API Design - Getting Started—Alen Pokos


requirements and to meet those requirements there can usually be three main pillars for building the solution so one is a client pillar one is a api pillar and one is a backend pillar again we are talking about the web concept here uh so when each of these pillars are strong we are happy and prosperous and the success is when all of them all the three pillars are working

API Design - Getting Started—Alen Pokos


towards a common goal instead of working towards the goal of one pillar uh so looking at the example for uh in the relationship between the client and the api uh there might be a case where our client needs uh the whole home page for its app in one request and this is something that usually in the api we don't think about like this or for example we have an article and the article has

API Design - Getting Started—Alen Pokos


an image so depending on the client we can do it either sending a url or we can have some complex resources additional logic behind it looking at the api and the backend relationship this is where usually things get a bit more complex in and it involves a lot of more work so sometimes an api can copy copy uh backend implementation one to one so we have the same data models we have the

API Design - Getting Started—Alen Pokos


same attributes uh and this can be a good start um but often uh because if we already know the backend implementation we can be biased towards the design of our api and this is uh this can sometimes limit our solution space so if we approach the api design isolated from the back end so not thinking about how the backend is implemented we can sometimes come up with a really

API Design - Getting Started—Alen Pokos


great designs that work uh well uh so for example if in your backend system you have a document revision system but on the api you only need to serve the latest version of the document there might actually be no need to show all this revision system in your apis so when looking at these three pillars if the pillars are too affected by each other our construction can become fragile and

API Design - Getting Started—Alen Pokos


unbalanced uh we can become coupled to the dynamic of these solutions uh so for example if our client is doing uh ui redesign and we need to change uh modify the apis because of it despite the data set being the same this can be an indicator that we are too coupled to the client or if a back end is doing some uh refactoring or optimizations and it requires us to

API Design - Getting Started—Alen Pokos


change our api again we are too coupled uh with uh with the back end again as this is the talk about the api so i will focus now more about the api itself uh so uh when thinking about the apis one thing that we can also try to test is okay how will it serve multiple clients does it need to serve multiple clients uh will it be served to multiple back ends uh how will the filtering down how would

API Design - Getting Started—Alen Pokos


the format done so there can be a lot of questions raised what we try to do is simplify and focus on the content instead of form so we should focus on what what kind of data what the data api provides and not how uh when we talk about how uh we usually think about the formats the structures uh and communication uh so this should not be our primary focus so imagine a world where everyone knows

API Design - Getting Started—Alen Pokos


what your apis work uh how your apis work and you just need to tell them what kind of data you are uh serving from it so as i mentioned before in recorder we use json api to help us with this uh what json api provides is uh enables us to stop worrying about the structure and covers a lot of frequent questions that we might find uh so uh json api removes for us the needs

API Design - Getting Started—Alen Pokos


to invent things uh that we don't need to reinvent uh the json api itself is a resource oriented api uh they do have a uh really well well written uh specification so i would suggest uh if you're interested to take a look at it and i'll go over a quick overview of uh basic features of the json api so uh looking at it so this is a basic structure or resource uh it combined it constrained it is

API Design - Getting Started—Alen Pokos


comprised of the type so usually some kind of type describing the resource the id of the resource and some attributes uh like a real world example let's see an article so we would have an article uh with an id1 and a title and the body of the article and uh so when we think about okay so i have an article i might need to uh see an author of the article so this is

API Design - Getting Started—Alen Pokos


done using the relationships so we can define a relationship and say okay relationship to this article is an author with a type of people so it gets pretty easy again thinking about okay i know the id of the user it would be great if i have this user included uh in my resource so again i can just simply have it included uh in the main response so again this is the response from from the main

API Design - Getting Started—Alen Pokos


endpoint if we need a relationship of a relationship yes the related resources are also resources so we can have a relationship and again using included we can include the relationship of that uh we can include the resource of that relationship as well so we can get the article the author and the thumbnail used uh to show this out um it looks beautiful uh so to summarize what what the json api

API Design - Getting Started—Alen Pokos


provides us that we don't need to think about so it provides us with client responsibilities it provides us a definition of service server responsibilities it defines a document structure uh it provides a fetching of resources and relationships and it provides a sparse field set so we can just have a selected set of data instead of the complete resources in addition it also provides us a

API Design - Getting Started—Alen Pokos


definition how how sorting can be done pagination filtering uh it provides a full crowd operation so it describes how we can create resources updated uh uh updaters relationships delete the resources uh and it also provides a standardized uh errors uh so again it's a it's a nicely written specification uh if you're not familiar with it feel free to check it out

API Design - Getting Started—Alen Pokos


so now that we covered uh some of the definition and some of the thought process uh we can dive into the example because there is a lot of good things to go over uh so first example first use case we have here is a user illustration i think that everyone has once in their life of development uh met with some kind of huge registration so let's look at our uh requirements so

API Design - Getting Started—Alen Pokos


we have a requirement that says that we have a mobile app mobile and web apps so we have two clients uh that have two-step registration in step one the user enters his username email and password and in the step two it enters additional personal information like uh name surname or a phone number so uh when we think about the api design how would we solve this uh well

API Design - Getting Started—Alen Pokos


there's actually a trick about it we don't so uh we ask the clients hey this is not our problem uh so from the api design perspective we enabled it uh what this means so uh we separate the work so client is responsible for covering the steps and the api needs to provide a way to validate and complete the registration process so we would serve an endpoint to validate

API Design - Getting Started—Alen Pokos


or verify the user enter data and we would uh serve an endpoint for uh process of registration itself if we look at the resource how would our resource look like so we would have a resource of the type user again this is just the name we can call it user we can call it uh a guest a person a buyer depending on your uh business uh business language and we would have some attributes uh for

API Design - Getting Started—Alen Pokos


example username password uh first name and last name uh so if you've ever done a registration uh there is another example we can mention here uh usually when you ask for the password you also it's a good practice to have a repeated password just in case the user misses or types it wrong so again this is something that we shouldn't do on the uh api level it should be done by the

API Design - Getting Started—Alen Pokos


client itself so the client can verify that two passwords are the same and just send us the password again if we want to think about it differently we can probably define the registration as a process of sending a registration request to create the user and then we can model our uh resource as such so we could have a resource that is type uh registration request

API Design - Getting Started—Alen Pokos


with the same attribute so we would have uh username password uh last firstnamelastname and then when we think about it okay so i send a request for registration and when i get a success response uh we can have the created user as in relationship so we can have additional relationship which is a user of type user so for any fans of the rpcs this is one option how you can do it when you use

API Design - Getting Started—Alen Pokos


json api what endpoints should we provide so we need an endpoint for uh creating of the user so for a resource and we provide additional endpoint for validation uh validation and can have a response okay if the validation is correct or a conflict or some kind of custom error and if we look at the other example for registration it could be a similar so we send have a registration endpoint and

API Design - Getting Started—Alen Pokos


registration validate endpoint okay next next use case is classified so to help with anyone who is not familiar with the term classified is a business for uh selling of uh online uh like for example an ebay uh in our case we work for a creation a platform called new scholar the items that you're selling are usually called a posting or a listing sometimes ad and this use case will be example of uh

API Design - Getting Started—Alen Pokos


evolution of the design as we get more knowledge additional requirements and to get more familiar with the topic that we are covering so uh first requirement is we need to serve the list of uh posted listings uh sounds simple enough so we would create a resource called listing and our listing would have a basic attributes of title description price and when it

API Design - Getting Started—Alen Pokos


expires and it's a simple resource we can have a list of them and just serve the all the listings in the database but then we get additional requirement that says hey can you please please include uh seller information like his name and his contact information so uh again a simple so simple approach would be we just modified the existing listing uh with the title description pricing

API Design - Getting Started—Alen Pokos


expires on and we add a seller name and a seller contact phone it's a simple addition uh but this is where the design thought process starts to think so uh the seller data can also be separated into additional uh additional resources and it can be reused on other endpoints so we could do it as additional resource so we would have again our listing with existing

API Design - Getting Started—Alen Pokos


attributes and we would have a relationship to a call seller to a special type of resource and let's look at some examples so first example would be we can have a research type seller and then we can have an attribute called display name and content form it's it's a pretty simple one uh we can be a bit more uh descriptive so again we could have a seller but we could also

API Design - Getting Started—Alen Pokos


signify that the seller is actually a user so we would have a relationship to some existing user and in this case our consumers can get even more data about it but looking at this example we can also uh think about the third example is that relation to the seller is a user so we can just have a resource user and we can have his username and phone uh directly attached

API Design - Getting Started—Alen Pokos


uh with this example then we get a new uh requirement which says a mobile application needs to mark ads that are owned by currently logged in user uh and expand an additional data so thinking about this request how how can we uh solve it so if you remember the previous slide it sounds like a ui thing right well correct we could enable this so uh we provide the mobile application with the example

API Design - Getting Started—Alen Pokos


to get the current logged in user and then the mobile app can have a simple logic as hey if the classified seller id is the same as the login user this is the logged in user so no additional data is needed for uh for the api and this is one example where we could become coupled to the ui but again if we think about design if we think about the requirements define them

API Design - Getting Started—Alen Pokos


correctly define the goal we can already see that this solution exists in our system let's look at another use case so uh there is a requirement that says okay i as a user need to see my items so we need to enable a seller to see all of the listings that uh he has he's the author of uh so there are a couple of ways we can do this so one way uh look in the json api uh

API Design - Getting Started—Alen Pokos


perspective we could filter the classifieds list and say okay filter classified list where seller is x and the x can be an id of the logged in user again this is all up to the clients to figure out the logged in user another example can be that we can add a special identifier called me and in that case depending on the context of the request uh we can see okay who is the

API Design - Getting Started—Alen Pokos


user authenticated with this request oh we can then filter it uh for the client uh this is a bit more friendly to the clients but again it might be a bit more coupled to the to the client and to the back end uh pillars another way we can also create a special uh endpoint like classified me or uh we can also uh create uh in the users on the user relation to the classified

API Design - Getting Started—Alen Pokos


so that the user can filter all of the classifieds that are related to his user uh so again to notify here that uh me keyword is a special in this case and this is again very very specific to the implementation and a bit more coupled to the to the back end so this is something to take into with caution uh another use case let's look at the messaging so we have a

API Design - Getting Started—Alen Pokos


simple uh functionality where a couple of uh users for this example a seller and buyer can have a conversation on the item or listing so looking at the resource we could have a resource type conversation uh and we have participants so we can have the attributes of when the uh conversation is created and then we can have a relationship to a uh classified so this is the item

API Design - Getting Started—Alen Pokos


that we are discussing about uh the buyer and the seller so the the two users that are uh currently participants of this conversation so looking at this conversation can have also additional attributes but we could already maybe uh simplify this so we can have a conversation that has a seller and a buyer and both of them are specified the specific research types so we can sell

API Design - Getting Started—Alen Pokos


it with the type seller buyer with the type buyer but also we can reuse them because looking at both of these user types they can be type of user so we reduce the number of special resources that we have another example another design choice that we can do here looking at the conversation example is that we can have a classified so we have a item that they're discussing

API Design - Getting Started—Alen Pokos


and we also have a seller but we already know the seller from the classified so we can uh say that uh seller is uh redundant because we can just say hey give me the seller of the class right so again design choice that we can simplify the endpoint by complicating the job for the client it's a design choice in this case it's really hard to say which one of the two is better

API Design - Getting Started—Alen Pokos


now that we have a conversation we also need to have some conversation messages uh again here is some we can have a resource type message and then we can have a design choice do we group the messages into conversations or we connect them directly to the participants so for example we would have a message that has a content it has a sent on and it has uh is read it's always read

API Design - Getting Started—Alen Pokos


by the recipient uh and then we can have a relationship that says okay it's part of the conversation x it has a sender and it has a recipient looking at this maybe we can find uh some redundancies because in the conversation we only need the sender and the recipient is the other party in the conversation so we can probably uh move this and also when we think

API Design - Getting Started—Alen Pokos


about sender and the recipient types we can look at some options so we have a sender who can be a resource type sender and we can have a recipient who is a resource type recipient thinking about the previous example they are both message participants so maybe we can have a reused resource type that has okay this is a conversation participants and we can reuse them

API Design - Getting Started—Alen Pokos


another thing so we can also remove the recipient because we already know that recipients are all the participants in the conversation so again we can simplify our message resource and look at the conversation resource for uh more information uh talking about the resource types so too many resource types can become a problem uh it can be a maintenance problem it can be a design problem

API Design - Getting Started—Alen Pokos


because uh you start to maybe get the track lose the track of which resources uh are uh intended for what so for example we can have a user we can have a buyer we can have a seller then we can send a recipient uh customer uh etc so if you look at all of these resources they can all uh be basically come down to a simple user or a customer or some other solution that

API Design - Getting Started—Alen Pokos


works for you so again thank you to account it's it's nice to have a really specific uh resources but when you build your apis it can become overwhelming and it can become a maintenance nightmare uh another use case that we can look about is a search so we have a simple request we have one search endpoint for several resource types so we can uh so let's look at the

API Design - Getting Started—Alen Pokos


one solution how we can build our search uh functionality so we have a resource type that search result and then it can have an attribute of title and some excerpt so we can show the matching keywords and relationships is where it gets interesting so let's say we have three main resource types that can be in our search results so we can have a classified you can have article and we

API Design - Getting Started—Alen Pokos


have category uh as uh the definition of json api says that you should only serve one resource type with endpoint so we need to have a search result and then using a relationship we can say okay this is a classified this is an article and this is a category and then within the included we can have the complete document uh another alternative for this uh can also be we can reuse

API Design - Getting Started—Alen Pokos


a relationship so we can have an attribute with uh title and excerpt and then we can have just one relationship which is called the result and depending on the type of the related uh resource we could know that it's a classified it's an article uh or it's a category so this is another example of how we can do this there are many more examples that i could be showing but given that

API Design - Getting Started—Alen Pokos


we cannot be here all day so yeah i've selected a few of more interesting ones and i hope you had a great time some takeaways that i would maybe hope to give you today so content and data we are building apis to provide some data some content naming is a big part of our design as well as thinking about how we will name things and design choice design decisions are

API Design - Getting Started—Alen Pokos


something that we do every day so it's not a matter of uh the best design choice it's a matter of is this design choice good for us sometimes there are several design choices that can be made that have a similar list of pros and cons it can be difficult but then it's just a matter of okay pick one and uh continue on uh when i talk about the api design and apis in general so this is

API Design - Getting Started—Alen Pokos


this is not the all that it's covering this uh this area there are some additional topics uh that could be covered like how can we do documentation on the api design uh how can we do a testing and validation of our apis versioning security so what kind of security are there not just authorization and authentication but also rate limits uh both protection topics like that there

API Design - Getting Started—Alen Pokos


is also caching and backend speed optimizations there is some recipes that we can use to improve our apis like that and also a lot of implementation details on how can we implement our apis so that is it for me uh and we can go over some of the questions uh and the q a uh you're muted dragon hi so let's see if uh we have any questions so far yeah yeah uh between

API Design - Getting Started—Alen Pokos


okay okay so this is a question where do you draw the line between okay uh requirement engineering and api is the api design so the api design is uh i would say a result of the requirements uh so uh just like you do uh ux design sometimes the wireframes are part of the requirements uh but it's usually the requirements define what we need to achieve and the api

API Design - Getting Started—Alen Pokos


design is part of the technical solution how will we achieve our goal so uh if there is some uh let's put like this one thing that can affect the requirements if there is some design choice that can help us save money time and uh bring better results then we can go back to the requirements and ask for change but usually we have requirements and then we get then we go to the design

API Design - Getting Started—Alen Pokos


stage uh does this answer your question great okay another question are we using swagger to build our api docs uh no right now we are using a postman uh to document uh our apis and we also use it to test so right now this is uh the tool we are using uh we have used swagger to build some apis more specifically the open api specification okay another one is there anything that

API Design - Getting Started—Alen Pokos


can help better visualizing the api design yes uh so um i'm thinking about how to answer because there are a couple of ways i can answer this uh so i don't know if there is any uh done tool like out of the box tool but one thing that we have been doing is building a map and this is one thing that json api is really good because uh all the resources can be so

API Design - Getting Started—Alen Pokos


basically adjacent api enables us to build a relational relationship uh of a relationship diagram of the whole uh api so yeah we have some tools that we developed to help us like build a uml diagram of all of our resources relationships attributes etc yeah okay a lot of questions uh this is a little bit of topic but uh yeah i know from ansible to uh thinking about it right now this uh out

API Design - Getting Started—Alen Pokos


of the box yeah we've used ansible for some stuff we used custom solution for some type we used uh symphony provided tools so uh yeah anything anything that works for you this is this is uh really specific to the technology stack to the solution to the infrastructure so there's a lot of factors i would say to answer this question a bit more fairly yeah uh recommendations on how to return

API Design - Getting Started—Alen Pokos


errors to the client and what's the importance of using http state to status codes in the in this regard uh uh short answer json api uh so uh this is again a great thing about the standards that we use uh json api standard which already helps us to describe how we should return errors what are the some of the status codes that are already part of the standards but there are some

API Design - Getting Started—Alen Pokos


that we use customly so yeah i would say use it semantically if nobody hates me for saying it like that uh yeah so json api is really good for that uh it helps us a lot with this kind of questions yeah uh include testing in the process um i would say testing is part of the development process uh but again depending on which tools you use uh for the design so for example we use uh

API Design - Getting Started—Alen Pokos


postman for the api design itself so when we are done with the design we already have a complete postman collections and we can use it for testing we can also automate it so yeah so we can use it uh we can use it in that way oh i i love this one yeah uh i actually have on one slide uh prepared for this yeah this is this was uh a common common question um so uh the graphql is one of those

API Design - Getting Started—Alen Pokos


technologies that we have used uh and um how to say it uh we've used with it uh it's they're pretty simple so despite they're being described as uh data and this is a resource uh the json api for us has a clear conventions which helps us speed up the development process uh it has the right amount of implicit versus explicit so graphql is a great tool if you need a bit more

API Design - Getting Started—Alen Pokos


let's say freedom but yeah if you like to design your own stuff but uh if you really want to use some standard json api works just fine and if you compare the two they can provide they provide pretty much the same uh functionality so yeah i i wouldn't say that either of them is uh better it's a personal taste maybe okay regarding content of data how would you rate having values in field that

API Design - Getting Started—Alen Pokos


reflect earnings instead of easily readable values so a philosopher philosophical answer here would be uh if you're using a strings or integers they're both atoms so we have a key that means something so if you use two or if you use call they are both kind of m's uh but yeah so uh this is this is an example where it's uh really good to separate the two uh pillars so from the back in

API Design - Getting Started—Alen Pokos


perspective you're using number constants from the api perspective you want something that is easily uh used by the client so i would probably most of the time i would prefer uh string so call something that when you look at the api as a per as a human or as a uh some kind of uh program you can you can then translate them into uh into your own values so if you use

API Design - Getting Started—Alen Pokos


value two value two is very back in specific usually and if you use a uh call it describes the action so it doesn't matter what constant is behind it so yeah this is this kind of the answer this is a really good example where you think about separating the back end from the api api is built for the consumer yeah hello girl uh how much an api script could be complex how do you snap

API Design - Getting Started—Alen Pokos


involves in the performance issue um yeah this is a good question uh in short it so the performance of the json api really uh depends on your implementation because you can implement it to be really fast and we have had some good uh cases where our implementation was really fast but if we sometimes we weren't maybe so oriented on performances and yeah you can really quickly

API Design - Getting Started—Alen Pokos


degrade the performance but it's again it depends on your technological stack you can improve it but from our example uh a json api can be really performant so there isn't a lot of problems with getting it to be performed yeah uh have you heard of netjs framework uh i don't i cannot say i've heard it uh it sounds like it's a js framework so maybe i should ask if somebody from my front and

API Design - Getting Started—Alen Pokos


colleagues is here to answer uh php typescript uh i mean in the company we so recorder is php based for the backend solutions uh we use symphony but we also have uh build building a uh node.js based uh backend solution so we are using symphony and some node.js solutions in the company uh what is the preferred way to implement ignition api uh the json api way again this is uh this

API Design - Getting Started—Alen Pokos


is a good question but we followed the json api specification and they just uh defined there's it basically are two main strategies how you can paginate one is offset limit and the other one is a page size so they the json api offers two ways you can pay in it depending on the prefer preferences of the client can talk about the best practices of api version uh

API Design - Getting Started—Alen Pokos


in my personal opinion yeah yeah okay i would maybe call it good practices best practices is uh this is kind of where it gets discussion oh something is better than the other um yeah i could talk about it i actually uh have uh in the in the longer version of this talk i actually mentioned a couple of things about the versioning so you could either a version by headers

API Design - Getting Started—Alen Pokos


you can either version by url you can version by uh resource yeah uh so i i would say not in the time that i have right now because it's a it's a really really uh a wide topic and i know there's a lot of options you can go with it okay thank you alan a lot of questions today we come to the end uh yeah just maybe to mention if you have any other questions feel free to contact me contact our

API Design - Getting Started—Alen Pokos


company or send me an message on you know and the recording of this talk will be in couple you can come back to via developers website and and find the recording uh back to stephanie if he's still with us if not thanks there okay i'm still alive uh there's another question right on implementing so this is kind of what i mentioned with uh constraints in the in the three uh main

API Design - Getting Started—Alen Pokos


principles uh so if you standards you already have some rules in the place another big thing is uh naming so you if you have a ambiguous language some kind of uh dictionary that you agree with your business which is again something that can help uh and yeah that would be probably the two most important uh ones because if you standards if you use uh business terminology you already have

API Design - Getting Started—Alen Pokos


the following is a conversation with jurgen schmidhuber he's the co-director of a CSA a lab and a co-creator of long short term memory networks LS TMS are used in billions of devices today for speech recognition translation and much more over 30 years he has proposed a lot of interesting out-of-the-box ideas a meta learning adversarial networks computer vision and even a formal theory

Juergen Schmidhuber: Godel Machines, Meta-Learning, and LSTMs | Lex Fridman Podcast #11


of quote creativity curiosity and fun this conversation is part of the MIT course and artificial general intelligence and the artificial intelligence podcast if you enjoy it subscribe on youtube itunes or simply connect with me on twitter at Lex Friedman spelled Fri D and now here's my conversation with jurgen schmidhuber early on you dreamed of AI systems that


self-improve recursively when was that dream born when I was a baby no it's not true I mean it was a teenager and what was the catalyst for that birth what was the thing that first inspired you when I was a boy I'm I was thinking about what to do in my life and then I thought the most exciting thing is to solve the riddles of the universe and and that means you have to become a


physicist however then I realized that there's something even grander you can try to build a machine that isn't really a machine any longer that learns to become a much better physicist than I could ever hope to be and that's how I thought maybe I can multiply my tiny little bit of creativity into infinity but ultimately that creativity will be multiplied to understand the universe


around us that's that's the the curiosity for that mystery that that drove you yes so if you can build a machine that learns to solve more and more complex problems and more and more general problems older then you basically have solved all the problems at least all the solvable problems so how do you think what is the mechanism for that kind of general solver look


like obviously we don't quite yet have one or know how to build one who have ideas and you have had throughout your career several ideas about it so how do you think about that mechanism so in the 80s I thought about how to build this machine that learns to solve all these problems I cannot solve myself and I thought it is clear that has to be a machine that not only learns to solve


this problem here and problem here but it also has to learn to improve the learning algorithm itself so it has to have the learning algorithm in a representation that allows it to inspect it and modify it such that it can come up with a better learning algorithm so I call that meta learning learning to learn and recursive self-improvement that is really the pinnacle of that why you then not only


alarm how to improve on that problem and on that but you also improve the way the machine improves and you also improve the way it improves the way it improves itself and that was my 1987 diploma thesis which was all about that hierarchy of metal or knows that I have no computational limits except for the well known limits that Google identified in 1931 and for the limits our physics


in the recent years meta learning has gained popularity in a in a specific kind of form you've talked about how that's not really meta learning with Newall networks that's more basic transfer learning can you talk about the difference between the big general meta learning and a more narrow sense of meta learning the way it's used today the ways talked about today let's take the


example of a deep neural networks that has learnt to classify images and maybe you have trained that network on 100 different databases of images and now a new database comes along and you want to quickly learn the new thing as well so one simple way of doing that as you take the network which already knows 100 types of databases and then you would just take the top layer of that and you


retrain that using the new label data that you have in the new image database and then it turns out that it really really quickly can learn that to one shot basically because from the first 100 data sets it already has learned so much about about computer vision that it can reuse that and that is then almost good enough to solve the new task except you need a


little bit of adjustment on the top so that is transfer learning and it has been done in principle for many decades people have done similar things for decades meta-learning true mental learning is about having the learning algorithm itself open to introspection by the system that is using it and also open to modification such that the learning system has an opportunity to


modify any part of the learning algorithm and then evaluate the consequences of that modification and then learn from that to create a better learning algorithm and so on recursively so that's a very different animal where you are opening the space of possible learning algorithms to the learning system itself right so you've like in this 2004 paper you described get all


machines and programs that we write themselves yeah right philosophically and even in your paper mathematically these are really compelling ideas but practically do you see these self referential programs being successful in the near term to having an impact where sort of a demonstrates to the world that this direction is a is a good one to pursue in the near term yes we had these


two different types of fundamental research how to build a universal problem solver one basically exploiting [Music] proof search and things like that that you need to come up with asymptotic Liam optimal theoretically optimal self-improvement and problems all of us however one has to admit that through this proof search comes in an additive constant an overhead an additive


overhead that vanishes in comparison to what you have to do to solve large problems however for many of the small problems that we want to solve in our everyday life we cannot ignore this constant overhead and that's why we also have been doing other things non universal things such as recurrent neural networks which are trained by gradient descent and local search


techniques which aren't universal at all which aren't provably optimal at all like the other stuff that we did but which are much more practical as long as we only want to solve the small problems that we are typically trying to solve in this environment here yes so the universal problem solvers like the girdle machine but also Markos who does fastest way of


solving all possible problems which he developed around 2012 - in my lab they are associated with these constant overheads for proof search which guarantee is that the thing that you're doing is optimal for example there is this fastest way of solving all problems with a computable solution which is due to Marcus Marcus jota and to explain what's going on there let's take


traveling salesman problems with traveling salesman problems you have a number of cities in cities and you try to find the shortest path through all these cities without visiting any city twice and nobody know is the fastest way of solving Traveling Salesman problems tsps but let's assume there is a method of solving them within n to the 5 operations where n is the number of


cities then the universal method of Marcus is going to solve the same trolley salesman problem also within n to the 5 steps plus o of 1 plus a constant number of steps that you need for the proof searcher which you need to show that this particular class of problems that Traveling Salesman salesman problems can be solved within a certain time bound within order into the


five steps basically and this additive constant doesn't care for in which means as n is getting larger and larger as you have more and more cities the constant overhead pales in comparison and that means that almost all large problems I solved in the best possible way our way today we already have a universal problem solver like sound however it's not practical because the overhead the


constant overhead is so large that for the small kinds of problems that we want to solve in this little biosphere by the way when you say small you're talking about things that fall within the constraints of our computational systems thinking they can seem quite large to us mere humans right that's right yeah so they seem large and even unsolvable in a practical sense today but they are still


small compared to almost all problems because almost all problems are large problems which are much larger than any constant do you find it useful as a person who is dreamed of creating a general learning system has worked on creating one has done a lot of interesting ideas there to think about P versus NP this formalization of how hard problems are how they scale this kind of


worst-case analysis type of thinking do you find that useful or is it only just a mathematical it's a set of mathematical techniques to give you intuition about what's good and bad mm-hmm so P versus NP that's super interesting from a theoretical point of view and in fact as you are thinking about that problem you can also get inspiration for better practical


problems always on the other hand we have to admit that at the moment as he best practical problem solvers for all kinds of problems that we are now solving through what is called AI at the moment they are not of the kind that is inspired by these questions you know there we are using general-purpose computers such as recurrent neural networks but we have a search technique


which is just local search gradient descent to try to find a program that is running on these recurrent networks such that it can or some interesting problems such as speech recognition machine translation and something like that and there is very little theory behind the best solutions that we have at the moment that can do that do you think that needs to change you think


that world change or can we go can we create a general intelligence systems without ever really proving that that system is intelligent in some kind of mathematical way solving machine translation perfectly or something like that within some kind of syntactic definition of a language or can we just be super impressed by the thing working extremely well and that's sufficient there's an


old saying and I don't know who brought it up first which says there's nothing more practical than a good theory and um yeah and a good theory of problem-solving under limited resources like here in this universe or on this little planet has to take into account these limited resources and so probably that is locking a theory in which is related to what we already have sees a sim totally optimal


comes almost which which tells us what we need in addition to that to come up with a practically optimal problem so long so I believe we will have something like that and maybe just a few little tiny twists unnecessary to to change what we already have to come up with that as well as long as we don't have that we mmm admit that we are taking sub optimal ways and


we can y'all not Verizon long shorter memory for equipped with local search techniques and we are happy that it works better than any competing method but that doesn't mean that we we think we are done you've said that an AGI system will ultimately be a simple one a general intelligent system will ultimately be a simple one maybe a pseudocode of a few lines to be able to


describe it can you talk through your intuition behind this idea why you feel that uh at its core intelligence is a simple algorithm experience tells us that this stuff that works best is really simple so see asymptotic team optimal ways of solving problems if you look at them and just a few lines of code it's really true although they are these amazing properties just a few lines of code then


the most promising and most useful practical things maybe don't have this proof of optimality associated with them however they are so just a few lines of code the most successful mmm we can neural networks you can write them down and five lines of pseudocode that's a beautiful almost poetic idea but what you're describing there is this the lines of pseudocode are sitting on top


of layers and layers abstractions in a sense hmm so you're saying at the very top mmm you'll be a beautifully written sort of algorithm but do you think that there's many layers of abstractions we have to first learn to construct yeah of course we are building on all these great abstractions that people have invented over the millennia such as matrix multiplications


and real numbers and basic arithmetic and calculus and derivations of error functions and derivatives of error functions and stuff like that so without that language that greatly simplifies our way our thinking about these problems we couldn't do anything so in that sense as always we are standing on the shoulders of the Giants who in the past simplified the problem


of problem solving so much that now we have a chance to do the final step the final step will be a simple one oh if we if you take a step back through all of human civilization in just the universe in check how do you think about evolution and what if creating a universe is required to achieve this final step what if going through the very painful and an inefficient process of evolution is


needed to come up with this set of abstractions that ultimately to intelligence do you think there's a shortcut or do you think we have to create something like our universe in order to create something like human level intelligence hmm so far the only example we have is this one this universe and you live you better maybe not but we are part of this whole process right so apparently so it might


be the key is that the code that runs the universe as really really simple everything points to that possibility because gravity and other basic forces are really simple laws that can be easily described also in just a few lines of code basically and and then there are these other events that the apparently random events in the history of the universe which as


far as we know at the moment don't have a compact code but who knows maybe somebody and the near future is going to figure out the pseudo-random generator which is which is computing whether the measurement of that spin up or down thing here is going to be positive or negative underlying quantum mechanics yes so you ultimately think quantum mechanics is a pseudo-random number


generator monistic there's no randomness in our universe does God play dice so a couple of years ago a famous physicist quantum physicist Anton Zeilinger he wrote an essay in nature and it started more or less like that one of the fundamental insights our theme of the 20th century was that the universe is fundamentally random on the quantum level and that whenever you measure spin


up or down or something like that a new bit of information enters the history of the universe and while I was reading that I was already typing the responds and they had to publish it because I was right that there's no evidence no physical evidence for that so there's an alternative explanation where everything that we consider random is actually pseudo-random such as the decimal


expansion of pi supply is interesting because every three-digit sequence every sequence of three digits appears roughly one in a thousand times and every five digit sequence appears roughly one in ten thousand times what do you really would expect if it was run random but there's a very short algorithm short program that computes all of that so it's extremely compressible and who knows


maybe tomorrow somebody some grad student at CERN goes back over all these data points better decay and whatever and figures out oh it's the second billion digits of pi or something like that we don't have any fundamental reason at the moment to believe that this is truly random and not just a deterministic video game if it was a deterministic video game it would be


much more beautiful because beauty is simplicity and many of the basic laws of the universe like gravity and the other basic forces are very simple so very short programs can explain what these are doing and and it would be awful and ugly the universe would be ugly the history of the universe would be ugly if for the extra things the random the seemingly random data points that we get


all the time that we really need a huge number of extra bits to destroy all these um these extra bits of information so as long as we don't have evidence that there is no short program that computes the entire history of the entire universe we are a scientists compelled to look further for that Swiss program your intuition says there exists a shortest a program that can backtrack


to the to the creation of the universe so the shortest path to the creation yes including all the entanglement things and all the spin up-and-down measurements that have been taken place since 13.8 billion years ago and so yeah so we don't have a proof that it is random we don't have a proof of that it is compressible to a short program but as long as we don't have


that proof we are obliged as scientists to keep looking for that simple explanation absolutely so you said simplicity is beautiful or beauty is simple either one works but you also work on curiosity discovery you know the romantic notion of randomness of serendipity of being surprised by things that are about you kind of in our poetic notion of reality we think as humans require randomness so


you don't find randomness beautiful you use you find simple determinism beautiful yeah okay so why why because the explanation becomes shorter a universe that is compressible to a short program is much more elegant and much more beautiful than another one which needs an almost infinite number of bits to be described as far as we know many things that are happening in this


universe are really simple in terms are from short programs that compute gravity and the interaction between elementary particles and so on so all of that seems to be very very simple every electron seems to reuse the same sub program all the time as it is interacting with other elementary particles if we now require an extra Oracle injecting new bits of information all the time for these extra


things which are currently no understood such as better decay then the whole description length our data that we can observe out of the history of the universe would become much longer and therefore uglier and uglier again the simplicity is elegant and beautiful all the history of science is a history of compression progress yes so you've described sort of as we build up


abstractions and you've talked about the idea of compression how do you see this the history of science the history of humanity our civilization and life on earth as some kind of path towards greater and greater compression what do you mean by there how do you think of that indeed the history of science is a history of compression progress what does that mean hundreds of years ago


there was an astronomer whose name was Keppler and he looked at the data points that he got by watching planets move and then he had all these data points and suddenly turnouts that he can greatly compress the data by predicting it through an ellipse law so it turns out that all these data points are more or less on ellipses around the Sun and another guy came along whose name was


Newton and before him hook and they said the same thing that is making these planets move like that is what makes the apples fall down and it also holds form stones and for all kinds of other objects and suddenly many many of these compression of these observations became much more compressible because as long as you can predict the next thing given what you have seen so far you can


compress it you don't have to store that data extra this is called predict coding and then there was still something wrong with that theory of the universe and you had deviations from these predictions of the theory and 300 years later another guy came along whose name was Einstein and he he was able to explain away all these deviations from the predictions of the old theory


through a new theory which was called the general theory of relativity which at first glance looks a little bit more complicated and you have to warp space and time but you can't phrase it within one single sentence which is no matter how fast you accelerate and how fast are hard you decelerate and no matter what is the gravity in your local framework Lightspeed always looks the same and


from from that you can calculate all the consequences so it's a very simple thing and it allows you to further compress all the observations because suddenly there are hardly any deviations any longer that you can measure from the predictions of this new theory so all of science is a history of compression progress you never arrive immediately at the shortest explanation of the data but


you're making progress whenever you are making progress you have an insight you see all first I needed so many bits of information to describe the data to describe my falling apples my video are falling apples I need so many data so many pixels have to be stored but then suddenly I realize no there is a very simple way of predicting the third frame in the video from the first tool and and


maybe not every little detail can be predicted but more or less most of these orange blocks blobs that are coming down they accelerate in the same way which means that I can greatly compress the video and the amount of compression progress that is the depth of the insight that you have at that moment that's the fun that you have the Scientific fun that fun in that


discovery and we can build artificial systems that do the same thing they measure the depth of their insights as they are looking at the data which is coming in through their own experiments and we give them a reward an intrinsic reward and proportion to this depth of insight and since they are trying to maximize the rewards they get they are suddenly motivated to come up with new


action sequences with new experiments that have the property that the data that is coming in as a consequence are these experiments has the property that they can learn something about see a pattern in there which they hadn't seen yet before so there's an idea of power play you've described a training general problem solver in this kind of way of looking for the unsolved problems


yeah can you describe that idea a little further it's another very simple idea so normally what you do in computer science you have you have some guy who gives you a problem and then there is a huge search space of potential solution candidates and you somehow try them out and you have more less sophisticated ways of moving around in that search space until you finally found a solution


which you consider satisfactory that's what most of computer science is about power play just goes one little step further and says let's not only search for solutions to a given problem but let's search two pairs of problems and their solutions where the system itself has the opportunity to phrase its own problem so we are looking suddenly at pairs of problems and their solutions or


modifications are the problems over that is supposed to generate a solution to that new problem and and this additional degree of freedom allows us to build Korea systems that are like scientists in the sense that they not only try to solve and try to find answers to existing questions no they are also free to impose their own questions so if you want to build an artificial scientist we


have to give it that freedom and power play is exactly doing that so that's that's a dimension of freedom that's important to have but how do you are hardly you think that how multi-dimensional and difficult the space of them coming up in your questions is yeah so as as it's one of the things that as human beings we consider to be the thing that makes us special the intelligence that makes us