« first day (4991 days earlier)      last day (181 days later) » 

00:18
I think I should watch Star Trek
00:39
@Marco That trope goes back to Doctor Who "Tomb of the Cybermen" (1967). Also Daleks. Also Darth Vader said "It is useless to resist." Also Douglas Adam's Vogons. And many more...
@PM2Ring I only just saw your PSA and as a result, one of our colony ships missed its arrival window. We lost 30 hairdressers, 200 middle-managers and 40 scrum consultants. I hope you're happy with yourself 🤪
@smci wow
01:04
@smci haha
 
3 hours later…
04:16
@smci I've been back for weeks :)
 
6 hours later…
10:25
I am trying to code a bit of AI with the followning tutorial: https://www.youtube.com/watch?v=Gq1Azv_B4-4&list=PLQVvvaa0QuDezJFIOU5wDdfy4e9vdnx-7&index=3
However, I am running into an issue that isn't present in the video. I've found the same problem here:https://stackoverflow.com/questions/67183501/setting-an-array-element-with-a-sequence-requested-array-has-an-inhomogeneous-sh, but downgrading np nor defining the array as dtype = object helped. any idea what could be happening?
import gym
import numpy as np

# Create the MountainCar environment with render_mode
env = gym.make("MountainCar-v0", render_mode="human")  # Specify render_mode



LEARNING_RATE = 0.1
DISCOUNT = 0.95
EPISODES = 25000

DISCRETE_OS_SIZE = [20] * len(env.observation_space.high)
discrete_os_win_size = (env.observation_space.high - env.observation_space.low) / DISCRETE_OS_SIZE
discrete_os_win_size = np.array(discrete_os_win_size, dtype=object)


q_table = np.random.uniform(low = -2, high = 0, size = (DISCRETE_OS_SIZE + [env.action_space.n]))
 
2 hours later…
12:33
@Qualcuno2 What is the issue? Are you asking me to create a new virtual env and download gym just to see what the problem is?
 
1 hour later…
13:35
I've linked the issue. Anyways, I can rewrite it: `
discrete_state = (state - env.observation_space.low) / discrete_os_win_size
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.`
 
1 hour later…
14:55
@smci hmm, nice!
15:27
@Qualcuno2 I'd be lying if I said I knew what this was doing but I think:
def get_discrete_state(state):
    print(state)
    print("**")
    print(env.observation_space.low)
    print("**")
    discrete_state = (state[0] - env.observation_space.low) / env.observation_space.low
    return(tuple(discrete_state.astype(np.int64)))
That said, what you return from that function is clearly not the same as state that goes in. It's clear from the printout that a tuple goes in, but that's a tuple of a numpy array and an empty dict and what you send back out is just a regular old tuple. I'm guessing that's not what you want. Still, it explains the error
You'll also note that I changed np.int to np.int64 because the former was removed a few versions back and will, itself, throw another error. The tutorial you're following is out of date
Ah, sentdex. I remember those days.
aaand, pretty much the same fix I just gave is the 4th comment under the video so you could have found that just scrolling under a 5 year old (ancient in programming terms) video
15:44
Thanks! It worked!
@roganjosh I did search with control + F, but I did not find anything
Nothing beats print() in debugging
2
Still, all I did was fix the error. I have a feeling that's not quite what you wanted to return and it'll probably just get compounded as you continue on the series
As a best guess (and it is a guess. I don't have time to research this) you'd want the state to come out in the same way it goes in
def get_discrete_state(state):
    discrete_state = (state[0] - env.observation_space.low) / env.observation_space.low
    return discrete_state.astype(np.float64), {}
16:20
Thanks again!
 
6 hours later…
22:20
@roganjosh I meant back at work... complaining about the heresy that is notebook coding style...
-I actually got it to work in the end after the horrendous stress
Linear regression FTW. Top-notch Data Sciencing
Any software or tech observations from Japan...? what's their attitude to AIs?
For some reason pd.read_xml is misbehaving... grr...
pandas and JSON do not work for me, so XML is presumably worse
It just needs a bit of hacking and mungeing... don't have the patience for that now, wanted to get on with the task.

« first day (4991 days earlier)      last day (181 days later) »