|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
On February 03 2018 01:15 Silvanel wrote: So i started learning C#. Not that i have other choice since company framework i need to use is exclusively written for C#. Any advices for beginner? (The only language i know already is Python). I don't know much python, so I can't really tell you stuff that would be relevant for someone switching from python to C#. Most important advice though: Get Resharper, preferably ultimate, and learn a new resharper command every day/week. 100% worth it. If your company doesn't already use it, try to convice them. Even if it only increases productivity by 1% it's probably well worth the cost already. It also makes refactoring easier, thus improving code quality and maintainability. And working in VisualStudio just is so much better with it than without.
Also get comfortable with the linq namespace. So this:
from s in names where s.Length == 5 orderby s select s.ToUpper(); and this:
names.Where(s => s.Length == 5).OrderBy(s => s).Select(s => s.ToUpper()); I prefer the latter version, though the difference is mostly aesthetical. Also Resharper can convert between the two versions with a few keypresses. Linq is one of the best parts of C# imo. To go with that, make sure you learn about and understand yield return and yield break.
C# is a nice language, but obviously not without issues. There are a few remnants of early versions of C# when it didn't support generics yet that still annoy me from time to time, but it rarely is a big deal. Also make sure you understand how events work with garbage collection, and read the msdn article on the disposable pattern. Otherwise you might run into a memory leak here and there.
|
On February 03 2018 01:15 Silvanel wrote: So i started learning C#. Not that i have other choice since company framework i need to use is exclusively written for C#. Any advices for beginner? (The only language i know already is Python).
Are you familiar with OOP, design patterns and collections (ADT)? If not, then I'd say this is more important than learning just C#. Once you know these topics, it doesn't matter if you use C#, Java, C++ or a similar language. The rest is just syntax and experience from my point of view.
|
On February 03 2018 02:02 spinesheath wrote:Show nested quote +On February 03 2018 01:15 Silvanel wrote: So i started learning C#. Not that i have other choice since company framework i need to use is exclusively written for C#. Any advices for beginner? (The only language i know already is Python). I don't know much python, so I can't really tell you stuff that would be relevant for someone switching from python to C#. Most important advice though: Get Resharper, preferably ultimate, and learn a new resharper command every day/week. 100% worth it. If your company doesn't already use it, try to convice them. Even if it only increases productivity by 1% it's probably well worth the cost already. It also makes refactoring easier, thus improving code quality and maintainability. And working in VisualStudio just is so much better with it than without. Also get comfortable with the linq namespace. So this: from s in names where s.Length == 5 orderby s select s.ToUpper(); and this: names.Where(s => s.Length == 5).OrderBy(s => s).Select(s => s.ToUpper()); I prefer the latter version, though the difference is mostly aesthetical. Also Resharper can convert between the two versions with a few keypresses. Linq is one of the best parts of C# imo. To go with that, make sure you learn about and understand yield return and yield break. C# is a nice language, but obviously not without issues. There are a few remnants of early versions of C# when it didn't support generics yet that still annoy me from time to time, but it rarely is a big deal. Also make sure you understand how events work with garbage collection, and read the msdn article on the disposable pattern. Otherwise you might run into a memory leak here and there. None of this is really relevant to a programmer new to C# that won't have much control over their environment.
My advice is to make a few quick scratch projects to get an idea of how it works in practice, tailored towards what you will be doing in the work place.
|
is it possible to program a self learning AI in such a way that restricts developing of some behaviors?
like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way.
|
On February 04 2018 02:34 mantequilla wrote: is it possible to program a self learning AI in such a way that restricts developing of some behaviors?
like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way. Yes, it is.
Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function.
|
On February 04 2018 03:42 Acrofales wrote:Show nested quote +On February 04 2018 02:34 mantequilla wrote: is it possible to program a self learning AI in such a way that restricts developing of some behaviors?
like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way. Yes, it is. Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function.
Until it teaches itself how to reprogram the reward...
|
On February 04 2018 18:36 emperorchampion wrote:Show nested quote +On February 04 2018 03:42 Acrofales wrote:On February 04 2018 02:34 mantequilla wrote: is it possible to program a self learning AI in such a way that restricts developing of some behaviors?
like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way. Yes, it is. Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function. Until it teaches itself how to reprogram the reward... Just in case you're serious (and if you are, stop watching Terminator and thinking that is how AI works): metalearning of that kind is currently not yet possible. But even if it was, it'd be something you, as the designer of the system, would control (at least enough to choose to implement it or not). So no. Current AI cannot teach itself to change the reward function.
|
On February 04 2018 19:14 Acrofales wrote:Show nested quote +On February 04 2018 18:36 emperorchampion wrote:On February 04 2018 03:42 Acrofales wrote:On February 04 2018 02:34 mantequilla wrote: is it possible to program a self learning AI in such a way that restricts developing of some behaviors?
like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way. Yes, it is. Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function. Until it teaches itself how to reprogram the reward... Just in case you're serious (and if you are, stop watching Terminator and thinking that is how AI works): metalearning of that kind is currently not yet possible. But even if it was, it'd be something you, as the designer of the system, would control (at least enough to choose to implement it or not). So no. Current AI cannot teach itself to change the reward function.
That’s exactly what an AI that could rewrite it self would say.
|
On February 04 2018 20:01 emperorchampion wrote:Show nested quote +On February 04 2018 19:14 Acrofales wrote:On February 04 2018 18:36 emperorchampion wrote:On February 04 2018 03:42 Acrofales wrote:On February 04 2018 02:34 mantequilla wrote: is it possible to program a self learning AI in such a way that restricts developing of some behaviors?
like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way. Yes, it is. Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function. Until it teaches itself how to reprogram the reward... Just in case you're serious (and if you are, stop watching Terminator and thinking that is how AI works): metalearning of that kind is currently not yet possible. But even if it was, it'd be something you, as the designer of the system, would control (at least enough to choose to implement it or not). So no. Current AI cannot teach itself to change the reward function. That’s exactly what an AI that could rewrite it self would say.
only a true scheming AI would make such an accusation...
|
It's still sort of fun to observe what kind of unexpected behaviour can arise from a given reward function, even if you believe it should be limiting the behaviour of the agent.
My favourite example was from a grad student's demonstration in a reinforcement learning course I was taking. He had a Roomba that was using an optical sensor (or something like that) to tell if it was on a black 'track' in a confined rectangle. The reward function was for rotating the wheels forward while over the black track, while being punished for moving when off it or going in reverse. The rotation of the wheels was meant to be an approximation of movement. The idea was for the agent to eventually learn how to continuously move along the track.
In some situations however, the Roomba could accidentally wedge itself into a corner with it's wheels suspended while remaining over the track. It would then begin maximizing its reward by spinning the wheels at top speed while they were suspended.
The recent discussion reminded me of this, and it seemed like a funny anecdote about an agent finding an unexpected (and degenerate) way of maximizing a reward function.
|
On February 05 2018 14:36 Mr. Wiggles wrote: It's still sort of fun to observe what kind of unexpected behaviour can arise from a given reward function, even if you believe it should be limiting the behaviour of the agent.
My favourite example was from a grad student's demonstration in a reinforcement learning course I was taking. He had a Roomba that was using an optical sensor (or something like that) to tell if it was on a black 'track' in a confined rectangle. The reward function was for rotating the wheels forward while over the black track, while being punished for moving when off it or going in reverse. The rotation of the wheels was meant to be an approximation of movement. The idea was for the agent to eventually learn how to continuously move along the track.
In some situations however, the Roomba could accidentally wedge itself into a corner with it's wheels suspended while remaining over the track. It would then begin maximizing its reward by spinning the wheels at top speed while they were suspended.
The recent discussion reminded me of this, and it seemed like a funny anecdote about an agent finding an unexpected (and degenerate) way of maximizing a reward function.
It is kind of funny and/or scary how much that sounds like a drug addict.
|
The vocabulary itself (reward function, agent, reinforcment) is causing us to project our emotions on it and humanize it. They shouldnt be using terms taken from psychology.
|
On February 05 2018 07:26 mantequilla wrote:Show nested quote +On February 04 2018 20:01 emperorchampion wrote:On February 04 2018 19:14 Acrofales wrote:On February 04 2018 18:36 emperorchampion wrote:On February 04 2018 03:42 Acrofales wrote:On February 04 2018 02:34 mantequilla wrote: is it possible to program a self learning AI in such a way that restricts developing of some behaviors?
like an AI that plays FIFA but doesn't use 1on1 tricks excessively. It would be lame if it tricks everyone and scores a goal that way. Yes, it is. Not very helpful answer, I admit, but machine learning relies on a reward (or cost) function. You can shape that any way you want. So if you can formalize the behaviour you want to exclude, you just penalize using it in the reward function. Until it teaches itself how to reprogram the reward... Just in case you're serious (and if you are, stop watching Terminator and thinking that is how AI works): metalearning of that kind is currently not yet possible. But even if it was, it'd be something you, as the designer of the system, would control (at least enough to choose to implement it or not). So no. Current AI cannot teach itself to change the reward function. That’s exactly what an AI that could rewrite it self would say. only a true scheming AI would make such an accusation...
(n)spooky(n+3)me
|
On February 05 2018 18:03 Silvanel wrote: The vocabulary itself (reward function, agent, reinforcment) is causing us to project our emetions on it and humanize it. They should be using terms taken from psychology. What on earth do you mean?
|
Should be obvious enough. Words have power. They define how we see world. If You take words normally aassiciated with human beings and use them on inanimate things it will cause people to project feelings onto them, humanise them. On the other hand when You use words normally assiaciated with inanimate obejcts on people You will help to dehumanise them and erode empathy.
Also i made mistake in my previous post i have writen "should" instead of "shouldnt".
|
|
My app has some DbAdapters and a Session to store the user's account.
Throughout my app I access the DB by creating a DB adapter, doing something with it, then closing it. I'm consider adding my DB adapters to either the Session or a separate object created at app startup to avoid having all that unnecessary code. Does this seem reasonable?
|
On February 08 2018 10:18 WarSame wrote: My app has some DbAdapters and a Session to store the user's account.
Throughout my app I access the DB by creating a DB adapter, doing something with it, then closing it. I'm consider adding my DB adapters to either the Session or a separate object created at app startup to avoid having all that unnecessary code. Does this seem reasonable? So what's the end goal of doing this? Because without more details, it sounds like you're trying to solve problems that aren't really problems.
|
Well I figure if I can do this I can remove a substantial amount of code. Instead of opening, using, then closing the adapter I can just have it open the whole time, and use it when I want it. This means that I can make inline calls to the DB without either wrapping it in a pointless function or cluttering up my code. I'm wondering whether my proposal is bad design, though.
|
On February 08 2018 11:41 WarSame wrote: Well I figure if I can do this I can remove a substantial amount of code. Instead of opening, using, then closing the adapter I can just have it open the whole time, and use it when I want it. This means that I can make inline calls to the DB without either wrapping it in a pointless function or cluttering up my code. I'm wondering whether my proposal is bad design, though. If I recall, you've asked similar questions before, and the general theme seems to be that you're putting a lot of undue emphasis on "decluttering" your code. Clean code should come naturally no matter what you're programming, and hacking functionality together is the opposite of that.
Long-short, always close your DB adapters. There may be niche cases where you will want to leave a connection open, but you should be able to clearly say why that's necessary from a system perspective.
Also, when you say "without...wrapping it in a pointless function", I hope you're just wording that poorly, because encapsulation is a fundamental aspect of OOP.
|
|
|
|