一个Self Taught Learning的简单例子

idea:

Concretely, for each example in the the labeled training dataset xl, we forward propagate the example through a convolutional and a pooling layer to obtain the activation of the hidden units a(2). We now represent this example using a(2) (the “replacement” representation), and use this to as the new feature representation with which to train the softmax classifier.

 

design:

In this exercise, our goal is to distinguish between the digits from 0 to 4. We will use an “unlabeled” dataset with all 10 digits to learn the filters; we will then use a labeled dataset with the digits 0 to 4 with which to train the softmax classifier.

 

procedure:

 

Step 1: Generate the input and test data sets

Step 2: Train RICA

Step 3: Extracting features

Step 4: Training and testing the softmax regression model

Step 5: Classifying on the test set

 

reference:

 

转载于:https://www.cnblogs.com/Wanggcong/p/4943697.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,下面是一个简单的学生管理系统的Python代码示例,包括Person类、Student类、Course类、Teacher类和Admin类: ```python class Person: def __init__(self, name, age, sex): self.name = name self.age = age self.sex = sex class Student(Person): def __init__(self, name, age, sex, id): super().__init__(name, age, sex) self.id = id self.courses = [] def add_course(self, course): self.courses.append(course) def remove_course(self, course): self.courses.remove(course) def show_all_courses(self): print("Courses taken by {}: ".format(self.name)) for course in self.courses: print("Course: {}, Teacher: {}".format(course.name, course.teacher.name)) class Course: def __init__(self, name, teacher): self.name = name self.teacher = teacher self.students = [] def add_student(self, student): self.students.append(student) student.add_course(self) def remove_student(self, student): self.students.remove(student) student.remove_course(self) def show_all_students(self): print("Students taking course {}: ".format(self.name)) for student in self.students: print("Name: {}, Age: {}, Sex: {}, ID: {}".format(student.name, student.age, student.sex, student.id)) class Teacher(Person): def __init__(self, name, age, sex, id): super().__init__(name, age, sex) self.id = id self.courses = [] def add_course(self, course): self.courses.append(course) def remove_course(self, course): self.courses.remove(course) def show_all_courses(self): print("Courses taught by {}: ".format(self.name)) for course in self.courses: print("Course: {}, Students: {}".format(course.name, len(course.students))) class Admin: def __init__(self): self.students = [] self.teachers = [] self.courses = [] def add_student(self, student): self.students.append(student) def remove_student(self, student): for course in student.courses: course.remove_student(student) self.students.remove(student) def add_teacher(self, teacher): self.teachers.append(teacher) def remove_teacher(self, teacher): for course in teacher.courses: course.teacher = None self.teachers.remove(teacher) def add_course(self, course): self.courses.append(course) def remove_course(self, course): for student in course.students: student.remove_course(course) self.courses.remove(course) def show_all_students(self): print("All students: ") for student in self.students: print("Name: {}, Age: {}, Sex: {}, ID: {}".format(student.name, student.age, student.sex, student.id)) def show_all_teachers(self): print("All teachers: ") for teacher in self.teachers: print("Name: {}, Age: {}, Sex: {}, ID: {}".format(teacher.name, teacher.age, teacher.sex, teacher.id)) def show_all_courses(self): print("All courses: ") for course in self.courses: print("Course: {}, Teacher: {}, Students: {}".format(course.name, course.teacher.name, len(course.students))) if __name__ == '__main__': admin = Admin() student1 = Student("Tom", 18, "Male", "001") student2 = Student("Jerry", 19, "Female", "002") admin.add_student(student1) admin.add_student(student2) teacher1 = Teacher("John", 35, "Male", "101") teacher2 = Teacher("Mary", 30, "Female", "102") admin.add_teacher(teacher1) admin.add_teacher(teacher2) course1 = Course("Math", teacher1) course2 = Course("English", teacher2) admin.add_course(course1) admin.add_course(course2) course1.add_student(student1) course1.add_student(student2) course2.add_student(student1) admin.show_all_students() admin.show_all_teachers() admin.show_all_courses() course1.show_all_students() teacher1.show_all_courses() admin.remove_student(student1) admin.show_all_students() admin.show_all_courses() ``` 以上代码实现了一个简单的学生管理系统,包含了添加学生、删除学生、添加教师、删除教师、添加课程、删除课程、查看学生、教师、课程等功能。同时,还包含了学生选课、课程添加学生、教师授课、课程添加教师等功能。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值