dogs

The name '…' does not exist in the current context

匿名 (未验证) 提交于 2019-12-03 02:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a list within my Main() and I'm trying to add an item to that list from within a variable. But it's throwing the error "The name 'dogList' does not exist in the current context" Inside my addDog() method, dogList.Add() is not working due to above. namespace DoggyDatabase { public class Program { public static void Main(string[] args) { // create the list using the Dog class List dogList = new List (); // Get user input Console.WriteLine("Dogs Name:"); string inputName = Console.ReadLine(); Console.WriteLine("Dogs Age:"); int inputAge

Keras学习教程七

匿名 (未验证) 提交于 2019-12-03 00:27:02
原文地址: https://nbviewer.jupyter.org/github/fchollet/deep-learning-with-python-not… 使用带有小数据集的网点 在小数据集上从头开始训练一个convnet 深度学习对于小数据问题的相关性 但更重要的是,深度学习模式在本质上是高度可重复使用的:您可以采用例如大规模数据集上训练的图像分类或语音 - 文本模型,然后在极其不同的问题上重用它,只需稍作更改即可。具体而言,在计算机视觉的情况下,许多预先训练的模型(通常在ImageNet数据集上进行培训)现在已公开可供下载,并且可用于以非常少的数据引导强大的视觉模型。这就是我们将在下一节中做的。 下载数据 www.kaggle.com/c/dogs-vs-cats/data (如果您还没有帐户,则需要创建一个Kaggle帐户 - 不要担心 ,这个过程是无痛的)。 import os, shutil # The path to the directory where the original # dataset was uncompressed original_dataset_dir = '/Users/fchollet/Downloads/kaggle_original_data' # The directory where we will # store our

Android 开发第二天

匿名 (未验证) 提交于 2019-12-02 23:53:01
IDE:Android Studio 3.5 RC 2 开发语言:Java SDK版本:Android 9.0 API 28 builde.gradle apply plugin: 'com.android.application' android { compileSdkVersion 29 buildToolsVersion "29.0.1" defaultConfig { applicationId "com.aaa.aListView" minSdkVersion 24 targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation

E - Dogs' Candies HDU - 5127

你。 提交于 2019-11-30 15:02:02
Far far away, there live a lot of dogs in the forest. Unlike other dogs, those dogs love candies much more than bones. Every candy has two attributes: the sweetness degree p and the sourness degree q. Different dogs like different candies. A dog also has two attributes: the fondness degree for sweetness x and the fondness degree for sourness y. So the deliciousness degree of a candy for a dog is defined as p×x + q×y. The dog king has a huge candy box. At first, the box is empty. The king can add candies to the box or take some candies from the box and eat them. There are always some dogs who

【转】LINQ之SelectMany

断了今生、忘了曾经 提交于 2019-11-30 03:22:19
转载来源 https://www.cnblogs.com/cncc/p/9840463.html 一、第一种用法: public static IEnumerable<TResult> SelectMany<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<TResult>> selector); 官方释义:将序列的每个元素投影到 IEnumerable<TResult> 并将结果序列合并为一个序列。 废话不多说,直接Post上代码: 1,编写Person类: class Person { public string Name { set; get; } public int Age { set; get; } public string Gender { set; get; } public Dog[] Dogs { set; get; } } 2,编写Dog类: public class Dog { public string Name { set; get; } } 请注意:在Person类里有一个Dog数组,用于存储实例化Person类所拥有的所有Dog集合,这里就是SelectMany的关键。 3、编写客户端试验代码: List<Person> personList

深度学习笔记14_猫狗分类案例优化 - 数据增强

不想你离开。 提交于 2019-11-28 10:39:27
猫狗分类案例优化 - 数据增强 数据增强的基本概念 **数据增强:**利用多种数字图像处理方法(旋转,剪切,错切,缩放,翻转,边缘填充)生成可信图像. 其目标是,模型在训练时不会两次查看完全相同的图像。这让模型能够观察到数据的更多内容,从而具有更好的泛化能力。 在keras中可以通过:ImageDataGenerator函数来实现图像的随机变换. rotation_range 是角度值(在 0~180 范围内),表示图像随机旋转的角度范围。 width_shift 和 height_shift 是图像在水平或垂直方向上平移的范围(相对于总宽度或总高度的比例)。 shear_range 是随机错切变换的角度。 zoom_range 是图像随机缩放的范围。 horizontal_flip 是随机将一半图像水平翻转。如果没有水平不对称的假设(比如真实世界的图像),这种做法是有意义的。 fill_mode是用于填充新创建像素的方法,这些新像素可能来自于旋转或宽度/高度平移。 import os , shutil original_data_dir = "G:/Data/Kaggle/dogcat/train" base_dir = "G:/Data/Kaggle/dogcat/smallData" if os . path . isdir ( base_dir ) == False :

SVM

本秂侑毒 提交于 2019-11-28 00:51:39
目录 支持向量机 准备数据 测试 支持向量机 本节将依SMO算法训练线性SVM, 核方法的使用可以很方便的进行扩展. import numpy as np import matplotlib.pyplot as plt 下面的Point的类中的: \[ g(x) = \sum_{i=1}^N \alpha_i y_i k(x_i, x) + b, \] \[ e = g - y, yg = y * g \] class Point: """ 因为在SM0算法中,我们需要不断更新以及判断数据点的 各种属性,所以创建了一个新的数据类型Point. """ def __init__(self, x, y, k, order, g, alpha, c): assert y == 1 or y == -1, "Invalid y" self.x = x #数据向量 self.y = y # 类 self.order = order #序 self.k = k #距离矩阵 self.c = c self.g = g self.yg = g * y #衡量违背条件的指标 self.alpha = alpha self.e = g - y def kkt(self, epsilon=0.001): """ 检查是否符合KKT条件 :epsilon: 条件判断时允许的误差 :return: 0

One-to-one

浪子不回头ぞ 提交于 2019-11-26 17:23:02
创建模型 在本例中, Place 和 Restaurant 为一对一关系 from django.db import models class Place(models.Model): name = models.CharField(max_length=50) address = models.CharField(max_length=80) def __str__(self): return "%s the place" % self.name class Restaurant(models.Model): place = models.OneToOneField( Place, on_delete=models.CASCADE, primary_key=True, ) serves_hot_dogs = models.BooleanField(default=False) serves_pizza = models.BooleanField(default=False) def __str__(self): return "%s the restaurant" % self.place.name class Waiter(models.Model): restaurant = models.ForeignKey(Restaurant, on_delete=models

Android 开发第二天

爱⌒轻易说出口 提交于 2019-11-26 15:07:10
IDE:Android Studio 3.5 RC 2 开发语言:Java SDK版本:Android 9.0 API 28 builde.gradle apply plugin: 'com.android.application' android { compileSdkVersion 29 buildToolsVersion "29.0.1" defaultConfig { applicationId "com.aaa.aListView" minSdkVersion 24 targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation

《笨办法学python3-Learn Python 3 the HARD WAY》-习题29 if语句

。_饼干妹妹 提交于 2019-11-26 02:36:16
学习内容: people = 20 cats = 30 dogs = 15 if people < cats : print ( "Too mant cats! The world is doomed!" ) if people > cats : print ( "Not many cats! The world is saved!" ) if people < dogs : print ( "The worls is drooled on!" ) if people > dogs : print ( "The world is dry!" ) dogs += 5 if people >= dogs : print ( "People are greater than or equal to dogs." ) if people <= dogs : print ( "People are less than or equle to dogs." ) if people == dogs : print ( "People are dogs." ) 运行结果: 知识点: 1.你认为if对它的下一行代码做了什么?为什么if的下一行需要4个空格的缩进? 若if后面返回的时True则执行if下面的内容。 if的下一行需要4个空格的缩进,和函数意义一样,这是包含在if里的内容 2