Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
009a63b
[20230321]Remove the Buzzer Time Off Code
Yejin715 Mar 21, 2023
60254e2
Dotmatrix 블록 형태 변경
RoboroboLab Mar 24, 2023
3e88a95
표쌤코딩 기능추가
pyocoding Mar 31, 2023
823fb54
Merge pull request #2478 from entrylabs/develop
Tnks2U Apr 4, 2023
e0eaaa1
테이블에서 빈 값일 경우 빈값으로 나타내도록 수정
Apr 6, 2023
e23904a
AIBOT 제어 블록 추가
jinirobot1 Apr 7, 2023
3f0d704
쪼코 블럭의 브라우저로 연결하기 기능 추가
entrydev Apr 8, 2023
121f798
Merge pull request #2479 from entrylabs/issue/6047
leunge Apr 10, 2023
26ae134
빈 값 제거 로직 추가
Apr 19, 2023
95f6ea5
신규 하드웨어 네오(NEO) 추가
SketchwareMoon Apr 20, 2023
0299cb1
오류 수정
Apr 20, 2023
1558968
Merge pull request #2484 from SketchwareMoon/develop-hw
Tnks2U Apr 20, 2023
c7835d0
Merge pull request #2472 from RoboroboLab/develop-hw
Tnks2U Apr 20, 2023
47d1d93
Merge pull request #2475 from pyocoding/develop-hw
Tnks2U Apr 20, 2023
8e1bb67
Merge pull request #2470 from Yejin715/develop-hw
Tnks2U Apr 20, 2023
b7db649
Merge pull request #2480 from jinirobot1/develop
Tnks2U Apr 20, 2023
3956f76
Merge pull request #2481 from tyranno/develop-hw
Tnks2U Apr 20, 2023
ffc3dad
fix: 코알라보드 모니터템플릿 다국어 변경
Tnks2U Apr 20, 2023
05dc798
refactor: 코알라보드 lint 적용
Tnks2U Apr 20, 2023
4d98ee5
Merge branch 'develop' into develop-hw
Tnks2U Apr 21, 2023
d7eaf63
fix: 마이크로비트2 웹연결 센서값 오류문제 수정
Tnks2U Apr 24, 2023
6230cbb
feat: retryLimit 값 수정
Tnks2U Apr 24, 2023
550ed9d
Merge pull request #2487 from entrylabs/issue/6150
Tnks2U Apr 24, 2023
1199636
fix: 웹연결 아이콘 수정
Tnks2U Apr 24, 2023
0b4000c
Merge pull request #2486 from entrylabs/develop-hw
Tnks2U Apr 25, 2023
9a7d411
Merge pull request #2485 from entrylabs/issue/6050
leunge Apr 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added images/hardware/neo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/hw/neo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/hw_lite/chocolite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/hw_lite/neo_lite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions src/class/learning/Classification.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import InputPopup from './InputPopup';

export const classes = [
'ai_learning_speech'
];
export const classes = ['ai_learning_speech'];

class Classification {
#type = null;
Expand All @@ -20,9 +18,11 @@ class Classification {

getResult(index) {
const result = this.#popup?.result || [];
const defaultResult = {probability: 0, className: ''};
if(index !== undefined && index > -1) {
return result.find(({className}) => className === this.#labels[index]) || defaultResult;
const defaultResult = { probability: 0, className: '' };
if (index !== undefined && index > -1) {
return (
result.find(({ className }) => className === this.#labels[index]) || defaultResult
);
}
return result[0] || defaultResult;
}
Expand All @@ -36,10 +36,10 @@ class Classification {

openInputPopup() {
this.#popup = new InputPopup({
url: this.#url,
url: this.#url,
labels: this.#labels,
type: this.#type,
recordTime: this.#recordTime
recordTime: this.#recordTime,
});
this.#popup.open();
}
Expand Down
8 changes: 6 additions & 2 deletions src/class/learning/Cluster.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { kmpp } from 'skmeans/kinit';
// import { kmpp } from 'skmeans/dist/node/kinit';
import floor from 'lodash/floor';
import _toNumber from 'lodash/toNumber';
import LearningView from './LearningView';
import Chart from './Chart';
import DataTable from '../DataTable';
Expand Down Expand Up @@ -153,14 +154,17 @@ class Cluster {
this.#trainCallback(1);
this.#isTrained = false;
const { data, select } = this.#table;
const filtered = data.filter(
(row) => !select.flat().some((selected) => !_toNumber(row[selected]))
);
const [attr] = select;

const { centroids, indexes } = kmeans(
data.map((row) => attr.map((i) => parseFloat(row[i]) || 0)),
filtered.map((row) => attr.map((i) => parseFloat(row[i]) || 0)),
this.#trainParam
);
this.#result = {
graphData: convertGraphData(data, centroids, indexes, attr),
graphData: convertGraphData(filtered, centroids, indexes, attr),
centroids,
};
this.#isTrained = true;
Expand Down
11 changes: 7 additions & 4 deletions src/class/learning/DecisionTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import _floor from 'lodash/floor';
import _max from 'lodash/max';
import _sum from 'lodash/sum';
import _mean from 'lodash/mean';
import _toNumber from 'lodash/toNumber';
import LearningBase from './LearningBase';
import { DecisionTreeClassifier as DTClassifier } from 'ml-cart';
import Utils from './Utils';
Expand All @@ -24,7 +25,7 @@ class DecisionTree extends LearningBase {
type = 'decisiontree';

init({ name, url, result, table, trainParam }) {
this.name = name;
this.name = name;
this.trainParam = trainParam;
this.result = result;
this.table = table;
Expand Down Expand Up @@ -157,8 +158,10 @@ function getData(testRate = 0.2, data) {
const tempMapCount = {};
const { select = [[0], [1]], data: table, fields } = data;
const [attr, predict] = select;

const dataArray = table
const filtered = table.filter(
(row) => !select.flat().some((selected) => !_toNumber(row[selected]))
);
const dataArray = filtered
.map((row) => ({
x: attr.map((i) => Utils.stringToNumber(i, row[i], tempMap, tempMapCount)),
y: Utils.stringToNumber(predict[0], row[predict[0]], tempMap, tempMapCount),
Expand All @@ -176,7 +179,7 @@ function getData(testRate = 0.2, data) {
select,
fields,
valueMap: { ...tempMap[predict[0]] },
numClass: tempMapCount[predict[0]],
numClass: tempMapCount[predict[0]] || 1,
};
}

Expand Down
7 changes: 5 additions & 2 deletions src/class/learning/LogisticRegression.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import _floor from 'lodash/floor';
import _max from 'lodash/max';
import _sum from 'lodash/sum';
import _mean from 'lodash/mean';
import _toNumber from 'lodash/toNumber';
import LearningBase from './LearningBase';
import Utils from './Utils';

Expand Down Expand Up @@ -182,8 +183,10 @@ function getData(validationRate, testRate, data, trainParam) {
const tempMapCount = {};
const { select = [[0], [1]], data: table, fields } = data;
const [attr, predict] = select;

const dataArray = table
const filtered = table.filter(
(row) => !select.flat().some((selected) => !_toNumber(row[selected]))
);
const dataArray = filtered
.map((row) => ({
x: attr.map((i) => Utils.stringToNumber(i, row[i], tempMap, tempMapCount)),
y: Utils.stringToNumber(predict[0], row[predict[0]], tempMap, tempMapCount),
Expand Down
Loading