GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — done · fciasth/pythonMLAction@fa4b9e7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .gitignore
  • 02
    • KNN.py
    • datingTestSet.txt
    • datingTestSet2.txt
    • digits.zip
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.gitignore‎

Copy file name to clipboard
+177-177Lines changed: 177 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -1,177 +1,177 @@
1-
# DIY
2-
target/
3-
4-
# svn
5-
.svn/
6-
# Linux System
7-
*~
8-
9-
# KDE directory preferences
10-
.directory
11-
12-
# Linux trash folder which might appear on any partition or disk
13-
.Trash-*
14-
15-
# Windows System
16-
# Windows image file caches
17-
Thumbs.db
18-
ehthumbs.db
19-
20-
# Folder config file
21-
Desktop.ini
22-
23-
# Recycle Bin used on file shares
24-
$RECYCLE.BIN/
25-
26-
# Windows Installer files
27-
*.cab
28-
*.msi
29-
*.msm
30-
*.msp
31-
32-
# Windows shortcuts
33-
*.lnk
34-
35-
# OSX System
36-
.DS_Store
37-
.AppleDouble
38-
.LSOverride
39-
40-
# Icon must end with two \r
41-
Icon
42-
43-
44-
# Thumbnails
45-
._*
46-
47-
# Files that might appear in the root of a volume
48-
.DocumentRevisions-V100
49-
.fseventsd
50-
.Spotlight-V100
51-
.TemporaryItems
52-
.Trashes
53-
.VolumeIcon.icns
54-
55-
# Directories potentially created on remote AFP share
56-
.AppleDB
57-
.AppleDesktop
58-
Network Trash Folder
59-
Temporary Items
60-
.apdisk
61-
62-
# Eclipse
63-
*.pydevproject
64-
.metadata
65-
.gradle
66-
bin/
67-
tmp/
68-
*.tmp
69-
*.bak
70-
*.swp
71-
*~.nib
72-
local.properties
73-
.settings/
74-
.loadpath
75-
76-
# Eclipse Core
77-
.project
78-
79-
# External tool builders
80-
.externalToolBuilders/
81-
82-
# Locally stored "Eclipse launch configurations"
83-
*.launch
84-
85-
# CDT-specific
86-
.cproject
87-
88-
# JDT-specific (Eclipse Java Development Tools)
89-
.classpath
90-
91-
# Java annotation processor (APT)
92-
.factorypath
93-
94-
# PDT-specific
95-
.buildpath
96-
97-
# sbteclipse plugin
98-
.target
99-
100-
# TeXlipse plugin
101-
.texlipse
102-
103-
# JetBrains
104-
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
105-
106-
*.iml
107-
108-
## Directory-based project format:
109-
.idea/
110-
# if you remove the above rule, at least ignore the following:
111-
112-
# User-specific stuff:
113-
# .idea/workspace.xml
114-
# .idea/tasks.xml
115-
# .idea/dictionaries
116-
117-
# Sensitive or high-churn files:
118-
# .idea/dataSources.ids
119-
# .idea/dataSources.xml
120-
# .idea/sqlDataSources.xml
121-
# .idea/dynamic.xml
122-
# .idea/uiDesigner.xml
123-
124-
# Gradle:
125-
# .idea/gradle.xml
126-
# .idea/libraries
127-
128-
# Mongo Explorer plugin:
129-
# .idea/mongoSettings.xml
130-
131-
## File-based project format:
132-
*.ipr
133-
*.iws
134-
135-
## Plugin-specific files:
136-
137-
# IntelliJ
138-
/out/
139-
140-
# mpeltonen/sbt-idea plugin
141-
.idea_modules/
142-
143-
# JIRA plugin
144-
atlassian-ide-plugin.xml
145-
146-
# Crashlytics plugin (for Android Studio and IntelliJ)
147-
com_crashlytics_export_strings.xml
148-
crashlytics.properties
149-
crashlytics-build.properties
150-
151-
# JAVA
152-
*.class
153-
154-
# Mobile Tools for Java (J2ME)
155-
.mtj.tmp/
156-
157-
# Package Files #
158-
*.jar
159-
*.war
160-
*.ear
161-
162-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
163-
hs_err_pid*
164-
165-
#Maven
166-
target/
167-
**/target/
168-
pom.xml.tag
169-
pom.xml.releaseBackup
170-
pom.xml.versionsBackup
171-
pom.xml.next
172-
release.properties
173-
dependency-reduced-pom.xml
174-
buildNumber.properties
175-
.mvn/timing.properties
176-
177-
logs/
1+
# DIY
2+
target/
3+
4+
# svn
5+
.svn/
6+
# Linux System
7+
*~
8+
9+
# KDE directory preferences
10+
.directory
11+
12+
# Linux trash folder which might appear on any partition or disk
13+
.Trash-*
14+
15+
# Windows System
16+
# Windows image file caches
17+
Thumbs.db
18+
ehthumbs.db
19+
20+
# Folder config file
21+
Desktop.ini
22+
23+
# Recycle Bin used on file shares
24+
$RECYCLE.BIN/
25+
26+
# Windows Installer files
27+
*.cab
28+
*.msi
29+
*.msm
30+
*.msp
31+
32+
# Windows shortcuts
33+
*.lnk
34+
35+
# OSX System
36+
.DS_Store
37+
.AppleDouble
38+
.LSOverride
39+
40+
# Icon must end with two \r
41+
Icon
42+
43+
44+
# Thumbnails
45+
._*
46+
47+
# Files that might appear in the root of a volume
48+
.DocumentRevisions-V100
49+
.fseventsd
50+
.Spotlight-V100
51+
.TemporaryItems
52+
.Trashes
53+
.VolumeIcon.icns
54+
55+
# Directories potentially created on remote AFP share
56+
.AppleDB
57+
.AppleDesktop
58+
Network Trash Folder
59+
Temporary Items
60+
.apdisk
61+
62+
# Eclipse
63+
*.pydevproject
64+
.metadata
65+
.gradle
66+
bin/
67+
tmp/
68+
*.tmp
69+
*.bak
70+
*.swp
71+
*~.nib
72+
local.properties
73+
.settings/
74+
.loadpath
75+
76+
# Eclipse Core
77+
.project
78+
79+
# External tool builders
80+
.externalToolBuilders/
81+
82+
# Locally stored "Eclipse launch configurations"
83+
*.launch
84+
85+
# CDT-specific
86+
.cproject
87+
88+
# JDT-specific (Eclipse Java Development Tools)
89+
.classpath
90+
91+
# Java annotation processor (APT)
92+
.factorypath
93+
94+
# PDT-specific
95+
.buildpath
96+
97+
# sbteclipse plugin
98+
.target
99+
100+
# TeXlipse plugin
101+
.texlipse
102+
103+
# JetBrains
104+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
105+
106+
*.iml
107+
108+
## Directory-based project format:
109+
.idea/
110+
# if you remove the above rule, at least ignore the following:
111+
112+
# User-specific stuff:
113+
# .idea/workspace.xml
114+
# .idea/tasks.xml
115+
# .idea/dictionaries
116+
117+
# Sensitive or high-churn files:
118+
# .idea/dataSources.ids
119+
# .idea/dataSources.xml
120+
# .idea/sqlDataSources.xml
121+
# .idea/dynamic.xml
122+
# .idea/uiDesigner.xml
123+
124+
# Gradle:
125+
# .idea/gradle.xml
126+
# .idea/libraries
127+
128+
# Mongo Explorer plugin:
129+
# .idea/mongoSettings.xml
130+
131+
## File-based project format:
132+
*.ipr
133+
*.iws
134+
135+
## Plugin-specific files:
136+
137+
# IntelliJ
138+
/out/
139+
140+
# mpeltonen/sbt-idea plugin
141+
.idea_modules/
142+
143+
# JIRA plugin
144+
atlassian-ide-plugin.xml
145+
146+
# Crashlytics plugin (for Android Studio and IntelliJ)
147+
com_crashlytics_export_strings.xml
148+
crashlytics.properties
149+
crashlytics-build.properties
150+
151+
# JAVA
152+
*.class
153+
154+
# Mobile Tools for Java (J2ME)
155+
.mtj.tmp/
156+
157+
# Package Files #
158+
*.jar
159+
*.war
160+
*.ear
161+
162+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
163+
hs_err_pid*
164+
165+
#Maven
166+
target/
167+
**/target/
168+
pom.xml.tag
169+
pom.xml.releaseBackup
170+
pom.xml.versionsBackup
171+
pom.xml.next
172+
release.properties
173+
dependency-reduced-pom.xml
174+
buildNumber.properties
175+
.mvn/timing.properties
176+
177+
logs/
Collapse file

‎KNN.py‎ ‎02/KNN.py‎KNN.py renamed to 02/KNN.py

Copy file name to clipboardExpand all lines: 02/KNN.py
+26-1Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from numpy import *
2+
import os
23
import operator
34
def createDataSet():
45
group = array([[1.0,1.1],[1.0,1.0],[0,0],[0,0.1]])
@@ -100,4 +101,28 @@ def img2vector(filename):
100101
return returnVect
101102
#测试
102103
# testVector = img2vector('testDigits/0_13.txt')
103-
# print(testVector[0,0:31])
104+
# print(testVector[0,0:31])
105+
def handwritingClassTest():
106+
hwLabels = []
107+
trainingFileList = os.listdir('trainingDigits') #load the training set
108+
m = len(trainingFileList)
109+
trainingMat = zeros((m,1024))
110+
for i in range(m):
111+
fileNameStr = trainingFileList[i]
112+
fileStr = fileNameStr.split('.')[0] #take off .txt
113+
classNumStr = int(fileStr.split('_')[0])
114+
hwLabels.append(classNumStr)
115+
trainingMat[i,:] = img2vector('trainingDigits/%s' % fileNameStr)
116+
testFileList = os.listdir('testDigits') #iterate through the test set
117+
errorCount = 0.0
118+
mTest = len(testFileList)
119+
for i in range(mTest):
120+
fileNameStr = testFileList[i]
121+
fileStr = fileNameStr.split('.')[0] #take off .txt
122+
classNumStr = int(fileStr.split('_')[0])
123+
vectorUnderTest = img2vector('testDigits/%s' % fileNameStr)
124+
classifierResult = classify0(vectorUnderTest, trainingMat, hwLabels, 3)
125+
print ("the classifier came back with: %d, the real answer is: %d" % (classifierResult, classNumStr))
126+
if (classifierResult != classNumStr): errorCount += 1.0
127+
print ("\nthe total number of errors is: %d" % errorCount)
128+
print ("\nthe total error rate is: %f" % (errorCount/float(mTest)))
Collapse file

‎datingTestSet.txt‎ ‎02/datingTestSet.txt‎datingTestSet.txt renamed to 02/datingTestSet.txt

Copy file name to clipboard
File renamed without changes.
Collapse file

‎datingTestSet2.txt‎ ‎02/datingTestSet2.txt‎datingTestSet2.txt renamed to 02/datingTestSet2.txt

Copy file name to clipboard
File renamed without changes.
Collapse file

‎digits.zip‎ ‎02/digits.zip‎digits.zip renamed to 02/digits.zip

Copy file name to clipboard
File renamed without changes.

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.