C2W1_Assignment_Cats vs Dogs

I have removed the code
And i don`t need help anymore.
Thank you)

Hello Viktor,

We are not suppose to share or show our codes on public post, kindly remove the codes, send the codes to the respective mentors only if asked by them for review.

Your directory codes are incorrect. please use the hints given in the cells or refer this

Regards
DP

Here you are mentioning you don’t need help anymore and then you DM me with some issue for tmp/cat???.
As you have deleted the content of this post, I do not remember your error. So if you are still having any error or issue with assignment, share the screenshot of your error and not the code. So mentors can guide you further.

Sorry for that. The screenshot of my error:

Hello Viktor,

Thank you for sharing the screenshot of your error.

based on your screenshot your this grader cell has incorrect code

As explained in the previous shared link in this post where it explains according to the hint given please follow these step to make the corrections

  1. Hints tells you to use os.makedirs to create your intermediate subdirectories not direct directories for your root path. So as I already have mentioned your first line of code is os.makedirs(root_path).
  2. Your next codes should use/add(here adding or append does not mean literally using + but using tuple) os.path.join to add to the new directories to the root path. So tuple root_path and files you want to create with tuples mentioned first with the append code which is here os.path.join and then os.makedirs
  3. Follow the 2 point for all the 6 files required to create the expected output. The second point is literal way of explaining how you need to write the code.

Believe me I spend hours correcting these code when I was doing this assignment, so you will also get it!!!

Let me know if you have cleared this.
Once you have cleared this section, the split data grader cell first wants you to create a source_directory which is mentioned as SOURCE_DIR(be particular about this segment as maintaining capital and lower-case of the DIR are to be followed as mentioned)

so when you are creating a file it should go for filename to the os.listdir with the SOURCE_DIR)
next mention what your file will contain here use the addition symbol for your SOURCE_DIR and filename
next you need to mention if os.path.getsize with tupling file should return with size of the file as greater than 0
next mention files append function to your filename or else print File is empty

Now you need to define training length, validation length, shuffled_set, training_set and validation_set with proper code line. use a similar code to shuffle ===>
your sets * random.sample(list, len(list)) shuffles a list

  • copyfile(source, destination) copies a file from source to destination
    then create copy file for training_set and validation_set separately where each set has your files which you can mention as source_file (SOURCE_DIR +filename) and for training_file + filename as you want. Later copy file and tuple your source_file and the file you append training files with file name. follow the similar instructions for the validation set for copy file.

P.S. I have told you all codes here in verbal written matter as you would learn more by trying yourself. Try following these instructions and see if you have cleared the test. If still not getting the desired result lemme know. Believe me when I had got the first cell by myself, I felt like I completed an exam :slight_smile:
So take a break, start fresh in early morning. You will get the codes if read these instructions and try the code accordingly you will clear these cells.

All the best

Regards
DP

1 Like

Hello Deepti,
Thank you for solving my problem.

The main problem was that I forgot to add the name of the file to the directory in destination of function copyfile()
Now I made that task and get result 100/100.

Thank you again very much,
Good luck

Regards
VP

1 Like

happy learning!!!

1 Like

I finally got the answer-Thank you very much for your help!

I thin k the hint is confusing, since it mentions the os.makedirs first and then the os.path.join afterwards, when one really has to join path names first and THEN make the directories. I had to look far and wide to finally figure this out.