#data-science-and-ml

1 messages · Page 277 of 1

serene scaffold
#
    from constants import TEAM_TO_TEAM_ABBR, TEAM_SETS
ModuleNotFoundError: No module named 'constants'```
#

their code contains broken imports.

desert parcel
#

What module is he using?

serene scaffold
desert parcel
#

that's specific

#

So if you're free now could you help me?

serene scaffold
#

not necessarily

desert parcel
#

Ahh alright then

serene scaffold
#

Sorry about that

sleek fjord
#

my friend used that

#

and it worked for him

desert parcel
sleek fjord
#

on the github under issues someone used it 6h ago, with them still being able to use the module

#

this is the setup

austere swift
#

So i have this distributed data parallel pytorch model that was working perfectly fine earlier, but now whenever I try to run it i get this error
RuntimeError: unable to open shared memory object </torch_4156_4021375431> in read-write mode
on the mp.spawn() line

#

Python 3.8.0, pytorch 1.7.1, cuda 11.0, cudnn 8.0.5, and ubuntu 18.04

#

I did some research into it and the only things that i found was to set the dataloader workers to 0 and to set the max number of segments for shared memory to 8192, neither worked

#

also tried reinstalling cuda, cudnn, and pytorch

#

ik its something in the os since the code didnt change

#

@ me if you have an answer

desert parcel
#

what does a shape of (-x, y) mean for a tensor/matrix?

lapis sequoia
#

how do you guys prefer to work with enormous excel files even ms access fail to open?

desert parcel
#

pass the excel file with pandas

#

then split the file into half or quarters then export it

#

It's just an idea i've actually never done it before

lapis sequoia
#

how one could do that? I mean I am a rookie with python I am trying to learn it like how you learn riding a bike

desert parcel
#

Oh idk let me mess around and see if I can get it to work

lapis sequoia
#

thank you

desert parcel
#

@lapis sequoia I got it to work

lapis sequoia
#

let me see

desert parcel
#

Alright

#

I'll dm you

sullen crescent
austere swift
#

And I’ve run this program multiple times before, it’s just now started doing this

#

So I don’t think it’s a problem with the hardware

sullen crescent
austere swift
#

I haven’t

#

I can’t try it right now but I’ll try it when I wake up lol

sullen crescent
#

With the increase of the model, the deadlock becomes more and more frequent.

austere swift
#

Okay, thanks for the help!

sullen crescent
#

try ulimit -n 500000

austere swift
#

Okay

#

If I have any problems I’ll ping you

green urchin
#

I am thinking of learning python. What is the best way to do it?

storm sigil
#

!resources @green urchin Hey check this out, we got some cool stuff in here

arctic wedgeBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

lapis sequoia
#

mmmm i dont wanna sort the output. I mean, maybe i am doing it wrong. I used sklearn LabelEncoder to asign numbers to the classes. And then, after using model.predict, i used np.argmax to get the index with the highest value. So i want 2 things: know if there is something like LabelDecoder, and return the n indexes with highest values

green urchin
#

@storm sigil thanks mate

hasty grail
arctic wedgeBOT
#

@hasty grail :white_check_mark: Your eval job has completed with return code 0.

[0 2 3]
lapis sequoia
#

well, as u can see, thats wrong

#

index 0, which correspond to 10, isnt on the top 3 highest values

hasty grail
#

!e

import numpy as np

arr = np.asarray([10, 50, 20, 30, 40])
top_k = arr.argsort()[::-1][:3]
print(top_k)
arctic wedgeBOT
#

@hasty grail :white_check_mark: Your eval job has completed with return code 0.

[1 4 3]
hasty grail
#

just had to invert it

#

!e

import numpy as np

arr = np.asarray([10, 50, 20, 30, 40])
top_k = arr.argsort()[-3:][::-1]
print(top_k)
arctic wedgeBOT
#

@hasty grail :white_check_mark: Your eval job has completed with return code 0.

[1 4 3]
lapis sequoia
#

mmmm ty

#

and can i somehow use sklearn to go from interger to the class name?

hasty grail
#

If your class names are in a numpy array then you can just index it

lapis sequoia
#
int_train_label = le.fit_transform(train_label).astype(np.float32)```
#

Just the other way

hasty grail
#

!e

import numpy as np

class_names = np.asarray(['a', 'b', 'c', 'd', 'e'])
predictions = np.asarray([10, 50, 20, 30, 40])
top_k_idx = predictions.argsort()[-3:][::-1]
top_k_classes = class_names[top_k_idx]
print(top_k_classes)
arctic wedgeBOT
#

@hasty grail :white_check_mark: Your eval job has completed with return code 0.

['b' 'e' 'd']
lapis sequoia
#

ty

grizzled hill
#

Any good course about solving differential equations in python ?

hollow scarab
#

is there a way to make df.iloc dynamic? I have a dataset with x length but that might change next week

#

and if I df.iloc for a bigger dataset then I get an error

#

I have 260rows, and it won'tl let me select more than 260, but if next weeks file will be longer than that will be lost

lapis sequoia
#

What do you want to use .iloc for

hollow scarab
#

@lapis sequoia I had to select more ranges, not sure if that works with loc

lapis sequoia
#

and what does that range represent?

#

if you want a fixed output regardless of row numbers, you could state a def function priorly

hollow scarab
#
  1. and 2. row, which is fixed every week, and 6-268 can change to 6-269, 6-270 depending on week @lapis sequoia
#

the column length is also fixed

#

just that 6-268 can be +/- 1-2

golden briar
#

Hi

lapis sequoia
#

i have downloaded some weights from internet for inceptionv3

#

how can i load them?

fringe gyro
#

hello everyone

#

who help plz

#

Choose the first note randomly or consider the first note of the
original score (e.g. G) ;
See in the table the notes that succeed it (Ex: for the note G, the successors
are : G, G i, D, D, C, A) ;
Choose a random note among these successors;
Repeat this process, as many times as necessary, starting from step b) by considering
each time the successors of the last selected note.

#

it's my pb in python

sturdy dune
lilac iris
#

so i am using imageai to detect stuff from a opencv video feed, problem is i have to record, the analyse, then see it, is there a way to make it run live?

weak sentinel
#

Hey, im trying to use a DQN on the LunarLander from OpenAI gym rn and im noticing that everyone else is using a python file instead of a notebook. Why is this? is there some advantage that im missing?

serene scaffold
lapis sequoia
#

If i am doing an image classification, and my test images have no back ground, will the nn be able to predict the same images with a background?

gaunt venture
#

hello, not sure if i should ask this here or in algos and dat astructs,, im trying to generate all the permutations given 12 numbers, and using between 12 and 6 at a time

#

so if i had [1,3,5,7,9,11,13,15,17,19,21,23],and length 8 i would want for example, ('3', '7', '13', '11', '9', '5', '1', '15')

#

but once i try for length 10,11 or 12, my pc freezes

#

a length of 10 has 239,500,800 permutations, and 11 and 12 lengths have 479,001,600

slender oracle
#

Also returns a generator instead of a list, so should be able to avoid any memory issues.

gaunt venture
#

ooh thank you! ill test it out, sounds perfect

gaunt venture
#

wait did you mean the normal permutations()? that's what i'm using

gentle wagon
#

mhm makes sense. Thanks for taking the time to answer my question !!

haughty turtle
#
I would need some help because I don't know what algorithm i could use for the following :
- Steve is 25 and he buys everyday orange juice 
- Maria is 23 and she likes to buy smoothies 
Steve & Maria tastes are pretty much the same.

- Juan is 16 and he only drinks sodas 
Juan tastes are not the same as Steve and Maria.

====================================================

I would like to do a matching algorithm that will return the users who have the same drink preference and a close age. To continue with the example, Steve and Maria would be matched together but not Juan. Which one should I use ?```
pseudo rivet
#

How do you convert a date string (using Dash's DatePickerSingle) to a date_object that can be used?

harsh reef
#

63/150 [===========>..................] - ETA: 1:05 - loss: 5.5540 - rpn_class_loss: 0.1711 - rpn_bbox_loss: 1.3187 - mrcnn_class_loss: 1.6656 - mrcnn_bbox_loss: 0.8899 - mrcnn_mask_loss: 0.6008
ERROR:root:Error processing image {'source': 'suncg', 'path': '/path/to/mlt/8a33bca7ed13c8d2698303625feba21a/000005.png', 'obj_mask_path': '/path/to/node/8a33bca7ed13c8d2698303625feba21a/000005.png', 'cls_mask_path': '/path/to/category/8a33bca7ed13c8d2698303625feba21a/000005.png', 'id': 8067}
Traceback (most recent call last):
ValueError: zero-size array to reduction operation minimum which has no identity

#

hey, can someone help me

#

its showing value error even after i changed the images into json using LabelMe any help?

tranquil nymph
#

I'm trying to create a panda dataframe from this

#

excel sheet

#

but it's exported from quicken so the first rows are messed up.

#
>>> df = xl.parse("grace_covenant", names=["Split", "Date", "Check #", "Payee", "Category", "Amount", "Balance"], header=7, index_col=1) 
>>> df.head()
Empty DataFrame
Columns: []
Index: []
#

this is my current output

lapis sequoia
#

I got a problem. I downloaded a npy file that contains images. Well, i guess images are on RGB. But since i am opening with opencv, i think it takes the images as if they were BGR. How to fix this?

#

cv2.imshow(text[i], cv2.resize(cv2.cvtColor(imgs[i], cv2.COLOR_RGB2BGR), (256,256)))

#

it sucks

#

too complicated

wintry nacelle
#

Why does it take it as BGR anyway?

lapis sequoia
#

if u know different ways pls tell me

#

ask the developers xD

#

but opencv read images as bgr

wintry nacelle
#

Okay I looked it up

#

It's because bgr was the standard for cameras back then

#

So you're stuck doing the conversion

#

If it makes it look less ugly, try spacing the code out between lines

lapis sequoia
#

i was wondering if imshow has any argument to fix this

#

because since my img is already an array

#

i cant use imread

wintry nacelle
#

I don't think you have any other option

lapis sequoia
#

and on imread i can specify how are the image channels

wintry nacelle
#

I am trying to learn machine learning, specifically generative adversarial networks. I am following an example on the Keras website detailing a variational autoencoder (we all gotta start somewhere). While I understand each individual line of code somewhat, I am lost as to what is generally happening, and I don't understand many of the choices made. I put this down to lack of both knowledge and experience. I would like help understanding just what is going on.
Example source: https://keras.io/examples/generative/vae/
Code with comments asking questions: https://paste.pythondiscord.com/wopadonuro.py
Also, one more thing left out. I set the batch size to 4. I wonder if this is a terrible idea.
Current model's progress:

safe tapir
#

Is there a way to get jupyter autocomplete for Classes only?

lapis sequoia
#

Are there any resources, guides, or books about structuring Python code for scientific applications?

slender oracle
#

I've used it for one-off/research type things at work

lapis sequoia
#

Thanks. I'll give it a look.

fervent flume
#

run code in vscode debugger: works fine.
run code from command line: crashes

#

happy new year 🙂

serene scaffold
fervent flume
#

it's something to do with pathos.multiprocessing

#

@serene scaffold

#

If I run it one way, everything dies. If i run it another way, it works fine

serene scaffold
#

ah. I actually don't know how you'd debug something that's running in parallel. Did you ask in #async-and-concurrency?

fervent flume
#

not yet

serene scaffold
# fervent flume not yet

You can ask about anything pertaining to "more than one thing happening at once" there, not strictly async/await stuff.

fervent flume
#

thanks

wintry nacelle
#

To commemorate the new year, I made something. Result of Keras example code that I shamelessly copied in order to learn more.

stuck galleon
#

Hey guys I’ve been wanting to make a program that would be able to watch a player of a game in a match and by the behavior and habits of that player be able to predict what they would most likely do in future scenarios. Any ideas on where to get started?

lilac iris
#

Hey! Im trying to use opencv-python and I have a weird issue, detection on my webcam is perfectly working however when i run it on a file, this happens: https://cdn.discordapp.com/attachments/677243335290912808/794521560597790721/unknown.png

Here is my code

blob = cv2.dnn.blobFromImage(frame, 1/255, (320, 320), (0, 0, 0), 1, crop=False)
    darknet.setInput(blob)
    
    layers = darknet.getLayerNames()
    outputs = [layers[idx[0]-1] for idx in darknet.getUnconnectedOutLayers()]
    outputs = darknet.forward(outputs)
    
    analyse(outputs, frame)
def analyse(outputs, frame):
    img_height, img_width = frame.shape[0], frame.shape[1]
    bbox = []
    class_ids = []
    probabilities = []

    for output in outputs:
        for detection in output:

            class_id = argmax(detection[5:])
            probability = detection[5:][class_id]

            if probability >= 0.5:
                bbox.append([int((detection[0] * img_width)-int(detection[2]*img_width)/2),
                             int((detection[1] * img_width)-int(detection[3]*img_width)/2),
                             int(detection[2]*img_width),
                             int(detection[3]*img_height)])
                class_ids.append(class_id)
                probabilities.append(float(probability))

    indicies = cv2.dnn.NMSBoxes(bbox, probabilities, 0.5, 0.3)
    
    for idx in indicies:
        idx = idx[0]
        box = bbox[idx]
        center_x, center_y, width, height = box

        cv2.rectangle(frame, (center_x, center_y), (center_x+width, center_y+height), (0, 225, 0), 2)
        cv2.putText(frame, f'{classes[class_ids[idx]].title()} - {round(probabilities[idx]*100, 2)}%', (center_x, center_y-10), cv2.FONT_HERSHEY_PLAIN, 1, (0, 225, 0), 2)
sullen crescent
lilac iris
#

oh ok

#

i cant rn, ill tell when im free later

lapis sequoia
#

wooooooooooo ive discovered something

#

if u fit a model, with 10 epochs, for example, and acc is low

#

and u increase epochs

#

If u dont compile the model again

#

the fit will start from the last epoch

#

idk if i explained xD

#
model.compile
#

Imagine those are diferent cells

#

if ur epochs are 10

#

and u run first cell, and then second

#

model will fit with 10 epochs

#

if u run second cell again

#

it will be as if u train model with 20 epochs

velvet thorn
#

yeah

#

because

#

fitting changes the model inplace

lapis sequoia
#

xd

#

this guy lmao

arctic wedgeBOT
#

@green jungle Per Rule 6, your invite link has been removed. If you believe this was a mistake, please let staff know!

Our server rules can be found here: https://pythondiscord.com/pages/rules

lapis sequoia
lapis sequoia
#

What is the best laptop to learn data analysis, machine learning, deep learning and neural networks?

fluid comet
#

Hello everyone, please tell me how to get all the elements of the list that pass according to the selection condition
pymongo

barren osprey
queen stratus
#

hey guys, very new in this python thing. just wanted to install tensor flow trying to reproduce results of this https://github.com/NVlabs/noise2noise

#

then this happened

#

it's still going at it

#

wondering if that's normal

mystic steeple
#

Hey, so I'm a little bit (a lot bit) of a noob and I have a problem I need to solve. I was wondering if someone could give me some pointers of A) if python can be used to solve this problem and B) if so, some tips for how to get started.
Basically, I have a list of every teaching and learning center in the country. (Roughly 2000) I need to plot where each one is on a map. This would be fairly easy if I had the coordinates for each, but I don't, all I have is the name of the town. And I really do not want to manually get the coordinates for all 2000 centers. 😅
I'm sorry if this is the wrong channel, but any help would be super appreciated.

queen stratus
#

I remember a friend of mine doing something similar

serene scaffold
#

@mystic steeple google maps probably has an api for what you're trying to do

queen stratus
#

I think there is something that auto encodes your stuff in google maps

mystic steeple
#

Darn that's exactly what I'm looking for! Thank you, I'll dig around for that.

feral spoke
#

Guys I was going through the lecture on stats and at some point they define the formulae for median of grouped data.
Can anyone here explain me how they came across the formulae?

#
Median = L + ((N/2 - Cf)/f) * W
#

where L is the lower limit of median class

#

N is number of observations

#

Cf is cummulative frequency of the previous median class

#

f is the frequency of median class

#

W is the width of median class

#

Kindly ping me if you guys know the solution to it

trim oar
lapis sequoia
#

how may i determine how many epochs do i need and what batch size?

stray owl
#

There isn't a set number, you want to be running your project multiple times to see what works best. Guard against not enough testing data and over-fitting.

lapis sequoia
#

cuz wow

#

93% acc

bronze skiff
#

though you probably want to hypwrparameter tune on a validation set

#

to prevent data leakage

lapis sequoia
#

loss: 0.2347 - accuracy: 0.9299 - val_loss: 0.2966 - val_accuracy: 0.9311

lapis sequoia
#

train = (34970, 898) validation = (8271, 898)

#

im also using data augmentation

bronze skiff
#

hyperparameter tuning on your final eval set poisons your results

lapis sequoia
#

what?

trim oar
trim oar
lapis sequoia
#

okey step by step @trim oar

#

I have 35k images for training and 8k for validation (without counting data augmentation on train)

#

I have 898 classes. 15 epochs and batch size was 32. Model achieved 93% acc.
However, all the images from training/validation havent brackground. So when i tried to predict an image with background, the correct answer isnt even on the top 5

lethal solstice
#

Hello everyone

#

someone have an issue with Scrapy like me when you try to do :

class BookingSpider(scrapy.Spider):
    name="booking", 
    start_urls=['https://www.booking.com/']
    
#     Callback function that will be called when starting your spider
    def parse(self, response):
        yield scrapy.FormRequest.from_response(response,
                                               formdata = {'ss': 'Lyon'},
                                               callback = self.after_search)
#

i got each time this error :

2021-01-01 20:40:23 [scrapy.core.engine] INFO: Spider opened
2021-01-01 20:40:23 [scrapy.utils.signal] ERROR: Error caught on signal handler: <bound method FeedExporter.open_spider of <scrapy.extensions.feedexport.FeedExporter object at 0x7f89db07af10>>
Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/scrapy/utils/defer.py", line 157, in maybeDeferred_coro
    result = f(*args, **kw)
  File "/home/jovyan/.local/lib/python3.8/site-packages/pydispatch/robustapply.py", line 55, in robustApply
    return receiver(*arguments, **named)
  File "/opt/conda/lib/python3.8/site-packages/scrapy/extensions/feedexport.py", line 291, in open_spider
    uri_params = self._get_uri_params(spider, feed_options['uri_params'])
  File "/opt/conda/lib/python3.8/site-packages/scrapy/extensions/feedexport.py", line 473, in _get_uri_params
    params[k] = getattr(spider, k)
  File "/opt/conda/lib/python3.8/site-packages/scrapy/spiders/__init__.py", line 36, in logger
    logger = logging.getLogger(self.name)
  File "/opt/conda/lib/python3.8/logging/__init__.py", line 2013, in getLogger
    return Logger.manager.getLogger(name)
  File "/opt/conda/lib/python3.8/logging/__init__.py", line 1285, in getLogger
    raise TypeError('A logger name must be a string')
TypeError: A logger name must be a string
lapis sequoia
#

anyone with high knownledges of ML could help me please? I have been stuck for a few days with this

wintry nacelle
#

Welp I just installed CUDA so I can use my GPU for training

lapis sequoia
#

u can use google colab to use gpu for training

wintry nacelle
#

Google colab is slower than running Jupyter natively and always disconnects

#

For me at least

#

I'd just rather use my own equipment'

lapis sequoia
#

for me it is working fine

wintry nacelle
#

Anyway I'll try to tackle your error while I'm waiting

lapis sequoia
#

it is not mine 😛

wintry nacelle
#

ok

#

Wait then what was this about:

anyone with high knownledges of ML could help me please? I have been stuck for a few days with this

lapis sequoia
#

aaah

#

that one hahaha

wintry nacelle
#

I'm generally stuck to, I don't know what z_mean is

lapis sequoia
#

yes, that one yes

#

what

wintry nacelle
#

One of Keras' examples for training a VEA uses z_mean as a variable

#

I don't know wtf it does

#

Hold on I'll scroll up and fetch it

lapis sequoia
#

i dont think i can help u xd u better wait @ gm or someone else

trim oar
lapis sequoia
#

how can i print that?

wintry nacelle
#

@ gm or someone else
?

lapis sequoia
#

okey i will ping u, cant rn

trim oar
#

Np

#

I'm also here and there so

wintry nacelle
#

Hey ian yu can you help me with my problem?

trim oar
#

@wintry nacelle Sorry, I'm not exactly familiar with z means

wintry nacelle
#

There are a handful more questions generally related to convolution in my question

#

Such as the numbers set for stride and output layers

#

What CUDA version is required for the latest nightly build?

#

nvm it's 11.0

lapis sequoia
#

@trim oar sorry i will have to train the model again q.q. But... i could share u my dataset, the one i use to train the model, and the images i am trying to predict, so maybe u can see what could go wrong

#

but i think is the background from images

trim oar
#

Most probably is

wintry nacelle
#

Finally I got tensorflow to work with my cpu

#

Only took an hour but man that is an uptick in performance

serene scaffold
#

Anyone who's worked with having lots of arrays that may or may not need to be in live memory at any given time: have you had success with storing arrays in a database of some kind? I'm wanting to get started on a Discord bot that will need to store ten or so (400,)-shaped arrays per text channel that it can see.

slender oracle
#

I think postgres supports arrays too, but haven’t used it in several years.

serene scaffold
slender oracle
serene scaffold
slender oracle
#

Though that's sort of because we also use airflow, which requires psycopg2 for postgres connectors.

lapis sequoia
#

can someone help me on nickel pls?

blazing bridge
#

Hi guys, I am building a pc, the specs are as follows:

i9 9900k,
Gigabyte Eagle 3070,
16 gb of 3000mhz ram at CL 15,
MSI MAG 360R cooler

Is this a good pc for deep learning

I can specify more parts such as the case and power supply but they aren't as important as the stuff above

onyx monolith
#

does anyone here know anything about how to preprocess fMRI datasets for ML?

lapis sequoia
#

@blazing bridge your 3070 will be fine for deep learning 👍🏼

blazing bridge
#

ok thank you @lapis sequoia

wintry nacelle
#

Are there any resources or guides on best ML practices? I feel like I know Tensorflow and Keras enough to finally understand code, but I want to know how to best create/train models

near star
lapis sequoia
#

!code

arctic wedgeBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

hybrid scroll
#

Hi guys, is it possible to get probability of classes in clustering with k=2?

fleet heath
hybrid scroll
obsidian delta
#

Hello, I have used Elastic Net model to use several columns of my dataframe to create a prediction column. Does anyone know how to now make it so I can give a new value input value for one of the columns and have it calculate a new prediction? (given new X, predict y)

fleet heath
hybrid scroll
#

I dont have experience in unsupervised learning, sometimes I still confused tho

#

So, is it possible to get probability in each class with number of cluser = 2?

fleet heath
#

Yes, you can get probability of a new data point if you have 2 clusters

hybrid scroll
fleet heath
#

Here the two classes are yes and no

obsidian delta
lapis sequoia
#

do u know any AI to remove background that can be used on python pls?
If so, could u give me the link to download?

sullen crescent
#

grabcut or watershed method

lapis sequoia
#

how opencv?

#

the background is not uniform

subtle grotto
#

Hey, i just started going thru Dataquest to learn python, and im trying to put into mathematical sense/logical sentences, what im learning. let me give you an example:

"for row in apps_data:"
for every row in apps_data, do this

im having trouble deciphering how this part works...
N=11

for value in range(N+1):
print(value)

how does this create a list of: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12?

if N already is assigned 11, how does 'value' not just equal 12?

gray ibex
#

range(N+1) mean you loop from 0 to N

subtle grotto
#

So specifically in a for loop, 'range' will print starting from where I want?

gray ibex
#

no your code is right

#

for i in range(N+1):
print(i)

#

it will print 0 , 1, 2, .. 11

#

if you assign N=11

lapis sequoia
#

guys i have a problem

#

I am not understanding this

#

I mean, I though U-2-Net was a NN

#

But the code here is using full opencv, i dont see the neural network anywhere

subtle grotto
gray ibex
lapis sequoia
#

yes

#

i mean, there is a model and stuff

#

but i dont see the model being used at all

gray ibex
#

in your colab, the said run u2net_test.py

#

*they

lapis sequoia
#

there is a cell called

#

Results

#

if u inspect the code

#

is pure opencv and numpy

#

there is no model there

#

but after cloning it repository, there is a folder called model

#

so i am a bit lost

gray ibex
#

i think they hide the code

lapis sequoia
#

u can see it

#

double click the cell

#

code opens

gray ibex
#

line 5

#

they call the .py file

lapis sequoia
#

ah okey

#

so what is the rest?

#

like

#

u can comment that line

#

and the code still working

gray ibex
#

when you run .py file it's will create the output but not display it

#

the cv2 below does the display

#

display in colab

lapis sequoia
#

rlly?

#

i think the cv2 below does the remove background thing

#

ah

#

true

#

so everything below

#

is to display what?

#

the bounding box and the mask coloured?

gray ibex
#

highlight them

lapis sequoia
#

okey

gray ibex
#

in line 23 they load output image from saved dir

lapis sequoia
#

where are we talking about?

#

the result cell

#

or the .py?

gray ibex
#

yeah the result cell

lapis sequoia
#

anyway to see line numbers?

#

okey got it

#

okey, that load_image is from keras.preprocessing

#

yeah i was like wtf

#

first lines are opening an image from results

#

and results is empty by default

#

now i see results gets files after calling the model

#

okey so, how can i download the model to my local machine?

#

the model already trained

gray ibex
#

the weight is already in the repo

#

so clone the github repo

light warren
lapis sequoia
#

i mean, i will only want the model and weights. I dont like the way it loads images and stuff

#

the data_loader.py

#

cuz the train.py is to train the model, and i wont

#

and the .pth idk what is it

gray ibex
#

the .pth is the weight of pytorch

#

you need it to run the trained model

lapis sequoia
#

uuuh

#

i dont have pytorch

#

do i need it?

gray ibex
#

pip install pytorch

#

yeah

lapis sequoia
#

i have keras and tf

gray ibex
#

if you want to use this repo, you must have pytorch

obsidian delta
#

I calculated RMSE and R2 for predictions, and compared them to the column that corresponds most to the target column.

My predicted column has RMSE of 25,74 and a R2 of 0.65 (seems low)
The column A had RMSE of 31,31 and R2 of 0.69

Does anyone know how it is possible that predicted column has lower RMSE but also lower R2?

Shouldn't lower RMSE equal higher R2?

lapis sequoia
#

isnt pytorch just a framework? like, a model is a model

#

no matter if made with pytorch or keras or what ever

#

right?

gray ibex
#

no

#

it trained by pytorch

#

you need pytorch to load .pth

lapis sequoia
#

yeah, but weights are just numbers for each neuron

gray ibex
#

yeah

#

but the way you define the model

#

you need a framewrok

#

the above repo use pytorch to do this

lapis sequoia
#

yeah, i understand that

#

but once u do model.save

#

shouldnt the model be just a model?

#

pytorch is based on tf

#

and keras too

sullen crescent
#

no, pytorch based on torch developed by facebook

lapis sequoia
#

i dont care to be honest. My point is that a model is a model, no matter how u create it

gray ibex
#

@sullen crescent is right

lapis sequoia
#

even if u create a model of 1 layer with 8 neuros, it will be a model with 1 layer and 8 neurons if u use keras, or pytorch, or tensorflow, or what ever

sullen crescent
#

u cant load model based on framework A to be loaded on framework B without converting it first

lapis sequoia
#

uuum

#

can i convert this repo model to keras one?

#

i would like having this one on keras

gray ibex
#

you can search u2net keras yo use another repo

lapis sequoia
#

since i use keras always, not pytorch

#

if possible

gray ibex
#

*to

lapis sequoia
#

???

#

XD

#

okey i think i got it

#

now... i am windows user

#

i think i dont have git clone

#

i have to manually download?

sullen crescent
#

u could convert pytorch model to tensorflow using onnx-tf

lapis sequoia
#

will keras load it? cuz i am using keras

#

not tf.keras

gray ibex
#

highly recommend swithching to ubuntu

lapis sequoia
#

(idk tbh)

lapis sequoia
sullen crescent
#

In Tensorflow 2.0 tf.keras will be the default and I highly recommend to start working using tf.keras

light warren
lapis sequoia
#

so i can uninstall keras?

sullen crescent
#

it depends on you, if you're still using keras as a standalone api or choose to integrate it with tensorflow v2

lapis sequoia
#

uuuh

#

i think i have tf 2.0

#

tensorflow 2.3.1

#

Keras 2.2.4
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.2

sullen crescent
#

since you found the implementation of U net for keras, its not an urgent to upgrade to tf.keras

lapis sequoia
#

well

#

i found it

sullen crescent
lapis sequoia
#

the link i posted above

#

has this

#

Python 3.6
numpy 1.15.2
scikit-image 0.14.0
python-opencv PIL 5.2.0
PyTorch 0.4.0
torchvision 0.2.1
glob```
#

do i still need pytorch???

sullen crescent
#

if you dont have pytorch in your pip -list then you have to install pytorch it

lapis sequoia
#

okey q.q

#

then why it is called u2net keras

#

if pytorch is needed too? XD

#

anyway, how do i use the model?

#

Merry Christmas

#

like, i used to

model = keras.models.load_model()
model.predict()```
gray ibex
sullen crescent
lapis sequoia
sullen crescent
lapis sequoia
#

?

#

?

#

#

#

oh

#

i was on the other one 😄

#

sorry hahaa

#

okey, i cloned the repo, and downloaded both models

#

u2net and u2netp (the p one is smaller)

#

now... If i have a proyect on pycharm, how can i use the model from there?

#

like model.load(); model.run(img)??

#

Can someone help me, I am trying to figure out how to write a bot that will read a bunch of text and than replicate it, I already have the data but have no idea where to start on the bot

#

pardon

#

@sullen crescent

#

@gray ibex maybe u are here? u.u

#

They’re busy having conversations with me, sir.

#

:/

#

Haha

south wedge
#

howdy pythonizers ?

#

howdy survivings ?

#

hello anyone alive ?

lapis sequoia
#

I have created a reddit bot that gave me a bunch of submissions, I am looking to write a program that reads all of them, and than writes its own submission, a sort of general summary of everything its read. I have seen similar programs do so with movies and stories. I am not looking for help with the specific code, just a general plan of how to do this

#

@velvet thorn can u help me please?

copper kindle
#

I got a question regarding hypothesis testing. anybody up for helping a lad out ?

lapis sequoia
#

I want to create a new python environment and I typed conda create -n py27 python=2.7 anaconda. Is it normal that it downloads lots of stuff?

#

could use some help wih CNNs and ANNS

lapis sequoia
#

Could I send you the error im getting?

lapis sequoia
#

Have anybody tried to prove the existence of God using data analysis?

serene scaffold
serene scaffold
lapis sequoia
serene scaffold
#

Python 2 is deprecated, so it's likely that that website is old. Check the pins for this channel for some other resources

lapis sequoia
#

I tried to learn with the coursera course by Andrew Ng but that one is kind of old

quick igloo
#

Where did you know data science

lapis sequoia
quick igloo
lapis sequoia
#

I am currently reading "Python for Data Analysis"

#

I am a math student but I am interest in data science

#

I start the coursera course and the udacity course on machine learning but the udacity course uses outdated programs

#

and the coursera one does not use python

lapis sequoia
lapis sequoia
#

I want to prove that God is real using data

limpid oak
#

I have this code

#

MUSTIL_NO_file_copy[['HB_NO','VILLAGE_NAME', 'DISTRICT_NAME','TEHSIL_NAME']] = [HB_No_extract(filename),VillageName_extract(filename), DISTRICT_NAME,TEHSIL_NAME]

#

but in console it showing this msg

#

usr/local/lib/python3.6/dist-packages/geopandas/geodataframe.py:853: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead

#

I don't understood what it means and solution

#

I tried MUSTIL_NO_file_copy.loc[:,'HB_NO','VILLAGE_NAME', 'DISTRICT_NAME','TEHSIL_NAME'] = [HB_No_extract(filename),VillageName_extract(filename), DISTRICT_NAME,TEHSIL_NAME]

#

but showing slicing error

#

please reply

lapis sequoia
lapis sequoia
#

I am looking for help extracting nested content of a json file into a pandas df;

{
 "result_type": "EXTENDED",
 "success": true,
 "projects": [
   {
     "project_id": 92770,
     "created_at": 1608319219000,
     "updated_at": 1608319219000
   },
   {
     "project_id": 91407,
     "created_at": 1606510177000,
     "updated_at": 1606510177000
   }
 ]
}```
#

I this exemple I want to import the projects only, and ignore the first 2 objects

#

any help or suggestions would be appreciated, I've been trying out a few solutions (i.e. json normalize) but nothing has worked so far

trim oar
late jackal
#

I know this isn't strictly python related but if I wanted to include SQL on an engineering resume where should I look for SQL certifications/courses ?

late jackal
#

ah ty

#

ill copy it over there in a bit thanks

torpid cave
#

@limpid oak it relies on how Python works

#

Try using .loc

#

when assigning values with slicers

lapis sequoia
#

Into a list

#

Df = pd.Dataframe(zip(list1,list2,list3),columns=[‘project_id’,’created_at’,’updated_at])

#

This should work ig

#

The lists should contain the values which you retrieve

#

list1 = [i[‘project_id’] for i in the_json_file]

#

Similarly for created at and updated at

#

Ping me if u have further queries

lapis sequoia
#

Hiiii

#

I am a beginner

#

I am using Ipython, I zoom the screen to write code

#

but there is something that bothers me

#

when I got to the bottom of the screen

#

my code just hide down and then I have to scroll down to see it

#

I usually use control L

#

and my code goes to the top of the screen

#

but

#

I want to be able to write code such that the screen follows me when I got to the bottom of it

#

Is it there something I am missing

#

Or I have to live with this problem?

#

When I press enter the screen do not show me the last line of code

lapis sequoia
#

@lapis sequoia hey help me please with this

lapis sequoia
#

i didnt get you could you explain again😅

#

you want the whole dataframe to appear?

#

is that what you are saying?

#

or...

#

@lapis sequoia

lapis sequoia
#

yeah

#

I mean line 12

lapis sequoia
#

Then I press enter

#

if you press enter that command ends

lapis sequoia
#

I am very very new

#

To this

#

Let me explain futher

#

Wait

#

k

#

So I press enter

#

yeah

#

go on

lapis sequoia
#

Where it shows me

#

Line 11

#

But I was in line 12

#

Then

#

I have to scroll down

#

To see the code I write in line 12

#

ohhh ok

#

got it

#

idt there is a solution to this and personally i dont work on command line much for data science

#

use jupyter

#

or colab

#

hosted notebooks are so g

lapis sequoia
#

I am just working on command line because of the book I am reading

#

im sure u can implement those same things in jupyter too

#

i mean i for one do

lapis sequoia
#

Thanks

lapis sequoia
lapis sequoia
mint palm
#

i think your issue is dependent on what you are using and nothing to do with the code you are writing

#

@lapis sequoia

lapis sequoia
#

I am going to use Jupyter from now on

#

MIT Machine Learning Professor plays The Stanley Parable I think this is fun to watch. https://youtu.be/OIEIr4wtVvU

Simulated existential crisis in the form of a video game. Please check out our sponsors:

OUTLINE:
0:00 - Introduction
0:48 - Round 1 - The Matrix
8:12 - Round 2 - Reincarnation
9:58 - Round 3 - Winning
12:39 - Round 4 - Adventure ...

▶ Play video
#

😂 🤣

mint palm
#

i am doing neural network for fun..........lol my specialization is in mechanical engg

#

just cuz i started to like coding

lapis sequoia
mint palm
#

gr8

#

infact i want career in software engg lol

#

😅

lapis sequoia
#

@mint palm What learning resource are you using?

mint palm
#

coursera edx so far

#

but i have to agree they are 20 percent

#

80 percent is curiosity and stacksoverflow

#

@lapis sequoia

#
  • you guys offcourse
lapis sequoia
#

@mint palm Cool I am also using those plus Udacity (this one has some criticism by some people but I think is ok)

#

Also I am reading books

mint palm
#

yeah thats a nice site too

lapis sequoia
#

I found the edx course to be a little heavy for a beginner like me tho

mint palm
#

i feel coursera has a really good neural network teacher

#

hes the founder of coursera himself

#

he teaches great

#

andrew ng

lapis sequoia
lapis sequoia
mint palm
#

neural network is inside machine learning

#

its like a tool for machine ;earning

#

u will eventually come across it in machine learning at some point

lapis sequoia
mint palm
#

oh yeah correct

lapis sequoia
#

@mint palm Do you think I need to learn machine learning first then Neural Network?

#

Or it does not matter the order

lapis sequoia
#

I am reading a book called "Python for Data Analysis" by the creator of pandas but I am thinking "Is not the same to just read the pandas and numpy documentation?"

#

Plus the book do not have exercises in which on can practice the things

pseudo moss
#

I am quite new to as well.....but i can tell for sure that if you can solve some intermediate algorithm problems in the language and know how the language works then you will not have any problem in understanding NEURAL NETWORKS

pseudo moss
#

The course i am taking on coursera covers the numby part that is required to implement a neutal network

#

Np

#

I can share you the course link if you want

lapis sequoia
#

which library is better for plotting

north plinth
#

I guess matplotlib

light warren
proven sigil
light warren
#

do you know i can change the delimiter

proven sigil
#

How are you loading the file

light warren
#

df4= pd.read_csv(data4,header=None)

proven sigil
#

df4= pd.read_csv(data4,header=None,sep='\t')

light warren
#

still comes up with 1 column

proven sigil
#

df4 = pd.read_csv(data4, header=None, sep=' ')

light warren
#

it works now

#

thanks soo much

proven sigil
#

Np!

#

'\s+'

#

This is better

light warren
#

another question, do u know how i can add header to the data?

light warren
proven sigil
#

Yes

proven sigil
light warren
#

thanks sooo much again

proven sigil
#

:)

lapis sequoia
#

Need

#

Need Help with Parsing server llogs from laravel :
Hello need help with parsing it and converting it to csv.
I have Thought about two nested loops . One reading each line of the text line and other parses and writes until 5 and starts again .
Logfile:
`location: /user/create
[ERROR]: Cant Connect to database
[ip]: 127.0.0.1
[line]:/middleware/resources(112)

[ERROR]: Cant Connect to database
[ip]: 127.0.0.1
[line]:/middleware/resources(112)
-------------------------------------`

loud spoke
#

is this related to data science?

#

(no)

#

i am maybe wrong

hard hound
#

Hey does anyone here work wth google colab?

loud spoke
#

Yep

#

i do

#

@hard hound

hard hound
#

is it good?

loud spoke
#

It is

#

For projects

#

i use it

hard hound
#

is it to replace jupyter notebooks

loud spoke
#

It IS a jupyter notebook

#

lol

hard hound
#

could you explain it to me if you are available?

loud spoke
#

No, im not available rn

hard hound
#

well okay

#

Hey could someone help me

#

I am getting error while cleaning data

#

ValueError: A given column is not a column of the dataframe

loud spoke
#

¯_(ツ)_/¯

hard hound
#

i have checked everything

hard hound
serene scaffold
# hard hound Help

I personally don't recommend notebooks for beginners because they can be confusing to debug if you aren't familiar with how cells of code work.

There's not enough information here to know what went wrong. Could you copy and paste the code as text, and copy and paste the error message as text? The error message is cut off in your screenshot.

hard hound
serene scaffold
#

(I don't find the word "noob" helpful, personally. I just thought you were calling yourself that.)

hard hound
#

hey seem cool

serene scaffold
#

!code

arctic wedgeBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

serene scaffold
#

^ whenever you're ready, just include your code and error message like that.

hard hound
#

heres the screenshot of error

#

well i do have another method with pandas but i want to solve the error with sklearn

serene scaffold
# hard hound

Text of text is preferable to screenshots of text. That aside, do you know what dataframe the error message is talking about?

hard hound
#

pandas

serene scaffold
# hard hound pandas

Right, Pandas is the library that has the DataFrame class, but which specific dataframe do you think the error is about?

#

what kind of data is it? I guess I would check to see what algorithms have been demonstrated to be predictive for that kind of data.

#

looks like stocks?

#

ah. I guess let's see what models have been predictive for future stock performance.

#

is this more about learning about AI, or is this going to be part of a "real" project?

#

I've not heard of torchtext.

hard hound
#

hey does anyone use their brokers api?

#

the one you trade with

upbeat storm
#

like robinhood

#

hes asking if you use robinhood or something like webull's api

fallow prism
#

seed = 2201433561
random.seed(seed)
np.random.seed(seed)
model = Doc2Vec(corpus, vector_size=vector_size, seed=1)
pca = PCA(n_components=2, svd_solver='full', whiten=True,random_state=seed)
HELP! this is not working, i can't make the same vector twice 😭

digital niche
#

Wrote a script to automatically collect gas meter readings from video. The service is running on my home k8s cluster and I'm doing a Notebook to go over the functions/algorithms I used. It was a fun but a little frustrating as OpenCV is a little quirky. This is a draft, still need to dive into decoding the analog dials using a heavy dose fudging the numbers.
https://github.com/brontide/Gas-Meter-Notebook/blob/main/gasmeter.ipynb

livid quartz
#

Whats up with this error? It only appears when I fit my ML model to undersampled data, but it does not appear when fit to oversampled or imbalanced data

#

"Precision is ill-defined and being set to 0.0 due to no predicted samples. Use zero_division parameter to control this behavior."

tepid hamlet
#

What does "data prediction" even mean? And no, PyTorch Text is not for "text files" it's an API for solving problems involving text data.

lapis sequoia
#

can i use multiple csv in plot

hidden halo
#

I have a pandas dataframe with a date column. I want to convert that column into a list of dates.
However, if I simply do list(df['date']) it gives me a list iwth numpy.datetime64() datatype. if I do df['date'].tolist() it converts the dates to integers.
How do I convert the dates to datetime.datetime data type?

lapis sequoia
#

pd.to_datetime(list(df[‘date’])) ?

lapis sequoia
#

can someone help me out with this error please?

#

am trying to do a machine learning model

#

whether or not a person wears mask

digital niche
#

@lapis sequoia it doesn't understand the file you're giving it.

lapis sequoia
#

oh but how do I fix it ?

digital niche
#

I've never used tensorflow, are you sure you're calling load_img correctly?

lapis sequoia
#

yeah

#

train test folders are in the same directory as the file

odd yoke
#

did you do import PIL.Image as pil_image ? @lapis sequoia

#

just to make sure that this is PIL.Image.open

#

oh wait nvm that's the internals of keras

lapis sequoia
#

yeah

quiet patio
#

hey does anyone know how to handle an error in lambda function

lapis sequoia
quiet patio
#

thanks

hard hound
wild sorrel
#

Hey guys, I have the following pandas code

import pandas as pd


def list_of_dicts_to_excel(seller_data, buyer_data, name):
    df_seller = pd.DataFrame.from_dict(seller_data)
    df_seller.set_index("PROPOSAL", inplace=True)
    df_buyer = pd.DataFrame.from_dict(buyer_data)
    df_buyer.set_index("PROPOSAL", inplace=True)
    with pd.ExcelWriter(f"{name}.xlsx", engine="openpyxl", mode="a") as writer:
        df_seller.to_excel(writer, sheet_name="Buyers")
        df_buyer.to_excel(writer, sheet_name="Sellers")

in which I wanted to make 2 sheets, one named "buyers" and the other named "sellers", and then each time I call my list_of_dicts_to_excel function, pandas should write each new data frame in the following available lines, but instead creates a new sheet for each function call. How can I accomplish my goal based on this code?

surreal valley
#

Anyone here work with AI? Wanting to do an object detection for different objects in images. My school uses a custom captcha and our teacher is giving us an A if we can make an AI that can solve it through training it with images

#

It’s like googles but doesn’t use the same images

#

Anyone have sources or articles I can read

#

^ tag me if u reply plz

hushed wasp
#

Hello,

I need to count in my dataframe the unique values in customer_unique_id and create a new column/variable counting the number of time a customer_unique_id appears, drop rows to only keep one customer_unique_id and eventually create a new category variable.

The Dataframe :

````customer_unique_id       order_id        category
   ef54                     '0024'           gift
   ab58                     '0587'         school
   yg41                     '0678'           gift
   af48                     '0469'           gift
   ef54                     '8514'         school
   af48                     '2771'           gift    ````

The expected Dataframe output :

      ````   customer_unique_id       order_id        category    number_of_orders      category_2
       ef54                     '0024'           gift            2                 school
       ab58                     '0587'         school            1                 Nan
       yg41                     '0678'           gift            1                 Nan
       af48                     '0469'           gift            2                 gift    ````

The most important for me is to understand how to create the variable numer_of_orders, but category_2 would be a bonus.

I don't have more than two orders per customer_unique_id.

Thanks!!

tall trail
#

Hey! so i have this weird thing goin on in plotly and its giving me headaches by now lol. does anyone have a clue whats going on with the y axis?

#

this is the code for the graph, i can also show you the dataframes

lunar arrow
#

Not really a data science but a numpy question, I have a 128 chars per line by 128 lines text file that contains hex data ([0-9,A-F]), and I'm currently reading it with
data = np.genfromtxt("data.txt", dtype=np.uint8, delimiter=1)
It works but my problem is, it reads each character as an entry, I want it to read each half character as an entry (like read each 4 bits, and treat them like an unsigned number between 0 and 16). Also I think it doesn't read the hex characters correctly

mellow vapor
#

Suppose i have 11 features and based on their mean value i calculate the MSE,now if user is allowed to modify 2 of the features by his own input,do i need to recalculate the mean squared error and root mean squared error?

fiery cobalt
velvet thorn
#

🥴

velvet thorn
#

look into MultipleLocator

#

if you want ticks at multiples of 56

fiery cobalt
#

never even knew about that, thanks

velvet thorn
lime jewel
#

Looking for data science help with sklearn's LogisticRegressionCV

Is there anyway to measure the variance in predictions for each fold during training with this method?

Please @ me if you respond to this question!

mellow vapor
#

@velvet thorn The course i m studying didn't re-evaluate those values

#

m displaying my code,so that you can get some insight and point me out where i m going wrong

#
# %%
# Loading required Modules
import numpy as np
import pandas as pd
from sklearn.datasets import load_boston
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error

# %%
# Loading the complete Dataset
boston_dataset = load_boston()
# Building and arranging Data
data = pd.DataFrame(data=boston_dataset.data,
                    columns=boston_dataset.feature_names)
# Optimized Version of the data used in analysis
features = data.drop(['INDUS', 'AGE'], axis=1)
# Taking log of the target values to reduce the skewness
log_prices = np.log(boston_dataset.target)
# Bulding and arranging the Price Dataset
target = pd.DataFrame(log_prices, columns=['PRICE'])
features.head()


# %%
# Create an empty array to replicate the features
property_stats = np.ndarray(shape=(1, 11))
# First row of values will contain the mean values of each feature
property_stats = features.mean().values.reshape(1, 11)

#
# %%
# Performing regression and obtaining mse and rmse
regression = LinearRegression().fit(features, target)
fitted_values = regression.predict(features)
mse = mean_squared_error(target, fitted_values)
rmse = np.sqrt(mse)

# %%
# Perform Prediction based on mean/user inputted values
# Indices based on the Features table
CHAS_IDX = 2
RM_IDX = 4
PTRATIO_IDX = 8


def logEstimate(nr_rooms, ptRatio, river=False, confidence=False):
    # Predict values based on user input if provided
    property_stats[0][RM_IDX] = nr_rooms
    property_stats[0][PTRATIO_IDX] = ptRatio
    property_stats[0][RM_IDX] = 1 if river else 0
    estimate = regression.predict(property_stats)
    if confidence:
        upper_bound = estimate+2*rmse
        lower_bound = estimate-2*rmse
        interval = 95
    else:
        upper_bound = estimate+rmse
        lower_bound = estimate-rmse
        interval = 68
    return estimate, upper_bound, lower_bound, interval

#
def getEstimate(nr_rooms, ptRatio, river=False, confidence=False):
    """
    Estimate a price of Property in Boston.

    Keyword Arguments:

    nr_rooms -- Number of rooms in the property

    PTRATIO -- Number of students per teacher in classroom for nearby schools

    CHAS -- True if property is near the river else 0 

    Confidence -- True if prediction range is 95% accurate or False for 68% accuracy

    """
    # COndition checking
    if(nr_rooms < 1 or nr_rooms > 9):
        print('Invalid Value of Rooms,it cannot exceed 9')
        return
    elif(ptRatio < 1 or ptRatio > 22):
        print("Invalid value for PTRATIO,it cannot exceed 22")
        return
    # By scaling the median we can get the idea of current house Prices
    zillow_current_median = 653.6
    target_medain = np.median(boston_dataset.target)
    scale_factor = zillow_current_median/target_medain
    estimate, upper_bound, lower_bound, interval = logEstimate(
        nr_rooms, ptRatio, river, confidence)
    # Converting log based values to 1000's dollar and scaling them
    estimate = np.around(np.e**estimate*1000*scale_factor, -3)[0][0]
    upper_bound = np.around(np.e**upper_bound*1000*scale_factor, -3)[0][0]
    lower_bound = np.around(np.e**lower_bound*1000*scale_factor, -3)[0][0]
    # Printing the values
    print(f'Estimated Price of the House is : {estimate} $')
    print(
        f'The Range of the Prices can be from {lower_bound} $ to {upper_bound} $')
    print(f'Confidence interval is {interval}%')
#

This getEstimate function is where i predict my values based on user input

#

but MSE is calculated just before that and the instructor in the course didn't calculate the mse again in the function to decide the range

crisp spruce
#

So back the common question... 😄 how to get started with ML and data scince? good with programming language and Ongoing is doing math any recommendation on what next?

cyan beacon
#

It depends on how you learn best, if you are into practice just give yourself a goal and do it.

#

You can ask around for ideas of beginner projects

crisp spruce
#

so its like learn a programming language and maths and jump into small projects apply? nothing additional to learn

cyan beacon
#

Years and Years of stuff to learn, but you have to practice otherwise you'll never be able to use anything you've learned

#

At least that's what worked for me.

lapis sequoia
#

would someone help me with a map-reduce and hadoop clustering problem?

#

i dont even know where to begin

vital ocean
#

yes?

#

can u just telll?
the prob?

lapis sequoia
#

whoops

#

sorry

#

I am way too new to this and I dont even know how to begin

vital ocean
lapis sequoia
#

and... how do I do that?

#

Again, wayyy too new at this I have no clue what I am doing

frail socket
#

hey data science peps :: can anyone send some reading materials or nice tutorial for dash plotly

#

and what`s in trend for a jazzy illustration library ?

pale hull
#

I'll see what I can do

frail socket
#

thanks

barren bluff
#

Hi Im having issues with my transfer learning project, I just added a question in #help-croissant if anyone is interested. didnt know there was a channel for this in advance

pastel willow
#

I'm trying to add an explicit content filter for images using opencv2
does anyone know where I might find a cascade file for detecting NSFW images?

#

would rather not have to download thousands of NSFW just to create a cascade file lmao

upbeat pagoda
#

Would it be possible to build a "lightboard" with just a webcam and machine learning

dreamy flume
#

hi all, I'm having a bit of trouble using pandas read_excel; is this the right place to ask?

#

I'm trying to read this file directly:
df = pd.read_excel('https://open.alberta.ca/dataset/11245675-b047-49fc-8bd1-cc2ce8314a6d/resource/e8aac308-c754-484c-b446-0c57ed0e8d37/download/baby-names-frequency.xlsx')

But I'm getting this error: xlrd.biffh.XLRDError: Excel xlsx file; not supported

I've tried changing https to http but that hasn't worked either.

#

The docs for read_excel say that the first argument (io) can be a url, so I'm not sure why this doesn't seem to work

glad hound
#

hii

ancient lichen
#

so I have this code:
https://hastebin.com/roregixuco.py
And I'm running it in google collaboratory, and it's saying that model.fit(training, output, n_epoch=1000, batch_size=8, show_metric=True) is raising IndexError: list index out of range in this inner code:
feed_dict[net_inputs[i]] = x. Idk why, but if anyone knows tensorflow, help would be awesome 🙂

jade zephyr
#

Does anyone know how I can access/modify arrays that are inside a dictionary?

velvet thorn
velvet thorn
#

this was the first result

manic granite
#

I have a big weird problem that is killing me

#

I found a pre-trained model on pytorch using GPU, but i wanna use keras. So i used pytorch2keras library (it uses onnx) to go from pytorch model to keras

#

Now, on colab it works, but i need it to run locally, and i dont have an nvidia GPU

#

So, keras model cries because the image are not on NHWC (batch, heigth, width, channels). My images are with channels first

#

Because the pytorch model was trained like this (i guess on GPU having channels first speeds ups things or w/e)

#

So if i use numpy.transpose, then the model cries because the recieved shape isnt the expected

#

The only fix i have think of is to add an useless layer at the top that recieves the images with the same shape the CPU wants. But since i wanna use the already pre-trained weights, this layer has to do nothing

#

Anyone could help?

wintry nacelle
velvet thorn
#

@manic granite what is transform?

#

do you mean transpose?

#

anyway, this is just a question of reshaping

manic granite
#

yes, transpose

manic granite
#

read my issue carefully again

velvet thorn
#

but

#

okay then

#

if you say so

manic granite
#

okey. reshape what?

manic granite
#

@velvet thorn

austere swift
#

just change "image_data_format": "channels_last" to "image_data_format": "channels_first"

tardy condor
#

Hi! May I ask about algorithm for machine learning here?

uncut shadow
#

Yeah

tardy condor
#

Is there any suggested algorithm if I want to use it for position estimation?

true geode
#

Hey, has anyone got any dash/plotly experience here? 🙂

boreal summit
boreal summit
manic granite
#

Default MaxPoolingOp only supports NHWC on device type CPU

austere swift
#

You’re training on cpu???

mortal trout
#

can someone help in a pandas related thing

#

i have a git project i just need to predict for custom input

#

it predicts for a tsv file

manic granite
austere swift
#

Ohhh ok

#

How exactly did you transpose it?

manic granite
#

transpose what???

#

I mean, the model is on pytorch

#

so i used pytorch2keras

#

i can share u the colab

#

u have to download the weights from the pytorch model from

austere swift
#

How did you transpose it that made it not like the shape?

manic granite
#

with transpose

#

numpy

#

(2,0,1)

austere swift
#

It should be 0231 right?

#

Because you’re turning NCHW to NHWC, so the second element is being moved to the last

#

So 0231

manic granite
#

it doesnt matter anyway

#

just read the error i get

#

So, keras model cries because the image are not on NHWC (batch, heigth, width, channels). My images are with channels first

#

So if i use numpy.transpose, then the model cries because the recieved shape isnt the expected

#

It cries for one thing or another

austere swift
#

then transpose the images too

manic granite
#

?????

#

what do u think i am transposing?

#

xdddddddddddddddd

austere swift
#

i mean change the model input, and transpose the images

manic granite
#

and i was trying to avoid this

austere swift
#

oh yeah

manic granite
#

since i already have weights

#

170 Mb

#

file size

#

i was trying to reuse them

#

and also idk the data set the model was trained with

austere swift
#

also, why not just use pytorch instead of using keras?

#

that would avoid all of this

manic granite
#

cuz the output from this model is gonna be the input from another one and this second one is of my own, written on keras

austere swift
#

that doesnt really matter, since the output can just be converted from a pytorch tensor to a numpy array and then moved as the input to the keras model

manic granite
#

ye i know but i just wanna use keras on everything and not load too many libraries

#

cuz i am planing to make a discord bot with this 😛

#

so if i could somehow make it working on keras......

royal thunder
#

guys i wanna learn ML

#

I dont know what tools is there to learn for starting

lapis sequoia
coral walrus
#

heya,

missing_values = ['?', '--']
rows = ['X', 'Y', 'Z']

df = pd.DataFrame({
    'A': [np.nan, np.nan, 0.979],
    'B': [np.nan, 0.478, 0.029],
    'C': [1.123, np.nan, 0.720],
    'D': [0.938, 0.498, np.nan],
    'E': [1.073, 0.766, 0.984]}, na_values=missing_values, index=rows)

df

is it no longer possible to replace NaN with custom missing values when creating a dataframe using na_values=''?

#

nvm, I guess I use df.fillna()

barren bluff
#

Hey what is a cost function and how does it work exactly?

manic granite
#

@velvet thorn i am still waiting for you to tell me what should i reshape to make it work

summer vine
#

Is it possible to get the mathplotlib pyplot figure image object?

nova plover
#

for ssml, what is the best way to edit individual words pitch, i know about the contour but it doesn't seem to be working very well

summer vine
torpid sphinx
#

Hi, when wanting to remove outliers from a boxplot, does “showfliers=False” only remove the outliers from the boxplot or from the data itself?
I would like to remove the outliers from the data itself

nova plover
#

guys i made a question on stack overflow

stable otter
#

Im still deciding between which one to use for deep learning projects. Tensorflow or pytorch
so advice would be great

odd lion
odd lion
odd lion
odd lion
velvet thorn
#

there are technical differences that relate to the computational graph, but not really something you need to worry about at this point?

#

starting on one at all would be more important IMO

stable otter
#

which one is better for just some light weight projects

velvet thorn
#

the differences are more obvious when you enter the depths of DL

#

you can create workable models very quickly with either

stable otter
#

ok thx

velvet thorn
#

a cost function represents the "cost" of doing something.

#

if you're doing supervised learning, it can be used to calculate how different your predictions are from actual data.

#

the concept also applies to other forms of ML

stable otter
#

are there functions for reinforement learning/q-learning or is it jus python logic

velvet thorn
#

you can just think of a reward function as the negative of the cost function though

#

(you want to maximise reward and minimise cost)

stable otter
#

like if you wanna make a model in tensorflow you'd say keras.Sequential(example)

#

what would u do for reinforcement learning

velvet thorn
#

ah, okay

#

so your question is more...what builtin primitives are there in TF/PyTorch for reinforcement learning?

#

long story short

#

it's a bit more involved

#

you'd probably need to write some more basic tensor operations

#

but there are libraries which provide appropriate abstractions on top of lower-level TF

#

I believe the TF website has examples

stable otter
#

ok thx

manic granite
#

@velvet thorn so u wont tell me ur brilliant solution of just reshape? 🙂

velvet thorn
#

so

#

take it that I was wrong and don't know how to

manic granite
#

that much ego that u cant admit u were wrong? like wow we all make mistakes

wintry nacelle
#

Simple question, I'm following the DCGAN tutorial though I am using it as a basis to learn more about GANs generally.
There's a step where I reshape the train_images numpy array from (60000, 28, 28) to (60000, 28, 28, 1). The tutorial doesn't explain why this is done beyond it being a preprocessing operation. Why add this 4th dimension?

#

oh

#

It's so that each element in the 3rd dimension is an array instead of a number unto itself

#

Feel a bit silly now

ancient lichen
#

anyone know how to get tensorflow to work on an m1 mac?

west junco
#

where is the best place to learn datastructures and algorithms as a beginner?

velvet thorn
#

you'll see this pattern a lot in many libraries because there's a need to disambiguate

#

if you look at classic ML, for example, which tends to take in tabular (2D) features

#

you can see that if you only had one sample, or one feature, one of the axes would have length 1

#

if the models accepted 1D data instead of 2D data with one singleton (length 1) axis, then they wouldn't be able to tell between those two cases

ancient lichen
#

gm you have any idea about my question?

velvet thorn
#

but what's the problem

ancient lichen
#

it always says 'Process finished with exit code 132 (interrupted by signal 4: SIGILL)'

velvet thorn
#

by M1 Mac

#

you mean the one with the new chip?

ancient lichen
#

yes

velvet thorn
#

I have little experience with Macs

ancient lichen
#

I've looked it up and people have various solutions including installing apple's forked version, but for some reason when I used that tensorflow just died

#

like it had no methods or anything

wintry nacelle
#

Hey GM I have a question that I could probably solve myself but it's currently giving me a nightmare since I have no clue how to do it.
I need to convert a bunch of .dds files into a nested numpy array containing RGBA data

#

I have no clue how to do that

ancient lichen
#

it has to do with them being on an ARM chip now

velvet thorn
#

could be a Mac-specific thing or something to do with your specific installation

#

can't help you there, sorry

ancient lichen
#

ight, thanks anyways

velvet thorn
wintry nacelle
velvet thorn
#

and what do you mean "nested" array

#

arrays should always be flat

#

unless you mean multidimensional?

ancient lichen
wintry nacelle
velvet thorn
velvet thorn
#

what do you want to do with it

ancient lichen
velvet thorn
#

or you can try SO

wintry nacelle
velvet thorn
#

what specific problem do you have then

wintry nacelle
#

The multidimensional numpy array itself

#

I don't know how to make it or fill the data properly

velvet thorn
#

hm

#

I am confused

#

thought you said you loaded it successfully

wintry nacelle
#

I can load each individal file correctly using glob and PIL

#

I can also convert it into numpy array data that I can then have read back

velvet thorn
#

what does each individual file represent?

wintry nacelle
#

A single graphic

velvet thorn
#

okay

wintry nacelle
#

Lemme send you an example

velvet thorn
#

go on

arctic wedgeBOT
#

Hey @wintry nacelle!

It looks like you tried to attach file type(s) that we do not allow (.dds). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a, .csv.

Feel free to ask in #community-meta if you think this is a mistake.

wintry nacelle
#

gdmit

#

Wait I know how to get a PNG version

#

actually know what screw it

velvet thorn
#

I mean

#

okay, I can understand that you load them into a numpy array

wintry nacelle
#

I'm in my learning phase so I'm just experimenting basically

velvet thorn
#

but what next

wintry nacelle
#

Do preprocessing, so color correction and adding padding to the image so that they are all 100x100 (they are not consistently sized)

velvet thorn
#

what colour correction algorithm do you want to apply?

wintry nacelle
#

Then sending it into the model should be easy

velvet thorn
#

and how do you want to pad the images?

#

I'm assuming

#

you want to roughly centre them

#

in the padding?

wintry nacelle
#

Right now I'm getting strange colors which I'm putting down to the RGBA values being mixed up in some way

velvet thorn
#

OKAY

#

it would have been helpful to know that

#

anyway

#

so what you really mean is

#

the image isn't being read properly?