ICP3 - Saiaishwaryapuppala/CSEE5590_python_Icp GitHub Wiki

Python and Deep Learning: Special Topics

Rajeshwari Sai Aishwarya Puppala

Student ID: 16298162

Class ID: 35

In class programming:3

Objectives:

1.Create a class Employee and then do the following, Create a data member to count the number of Employees

Create a constructor to initialize name, family, salary, department Create a function to average salary

Create a Fulltime Employeeclass and it should inherit the properties of Employee class

Create the instances of Fulltime Employee class and Employee class and call their member functions

2.Write a simple program that parse a Wiki page mentioned below and follows the instructions: https://en.wikipedia.org/wiki/Deep_learning

Print out the title of the page

Find all the links in the page (‘a’ tag)

Iterate over each tag(above) then return the link using attribute "href" using get

Save all the links in the file

3.Using NumPy create random vector of size 20 having only float in the range 1-20.

Then reshape the array to (4x5)

Then replace the max in each row by 0(axis=1)(you can NOT implement it via for loop)

Employee Class

Code

  • Created a class Employee

  • A data member is created "emp_count" which gives all the count of the employees

  • A constructor is initialized with name, family, salary, department

  • Function Average is created which gives the average salary.

  • I am calling Employee class from inherited class Fulltime employee with arguments as name, family, salary, department

  • As you can see one more field has been added in the subclass.

  • Now, emp_count and average is called by class because I have created them as static.

  • employee_info is called with an object which is of FullTime_Employee as it is not static and displays the information sent in the subclass also.

Output:

  • As you can see output shows the employee count and average salary

  • It shows the employee info too

  • The child subclass is using the properties of the parent class

Web Scraping

Code

  • Set the URL you want to webscrape from url = "https://en.wikipedia.org/wiki/Deep_learning"

  • Connect to the URL

  • Parse HTML and save to BeautifulSoup object

  • Iterate through all the tags and get the links

  • Writing all the links into a file

Output

Numpy

  • Generates a random sample from a given 1-D array

  • Replace is used to avoid the duplicates

  • Max value is replaced with Values

Code

Output

You can see the output after creating a random vector and replaces the max value