本文整理汇总了Java中tech.tablesaw.api.Table类的典型用法代码示例。如果您正苦于以下问题:Java Table类的具体用法?Java Table怎么用?Java Table使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Table类属于tech.tablesaw.api包,在下文中一共展示了Table类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import tech.tablesaw.api.Table; //导入依赖的package包/类
public static void register() {
Displayers.register(Table.class, new Displayer<Table>() {
@Override
public Map<String, String> display(Table table) {
new TableDisplay(
table.rowCount(),
table.columnCount(),
table.columnNames(),
new TableDisplay.Element() {
@Override
public String get(int columnIndex, int rowIndex) {
return table.get(rowIndex,columnIndex);
}
}
).display();
return OutputCell.DISPLAYER_HIDDEN;
}
});
}
示例2: apply
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isInQ3();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isInQ3();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isInQ3() ");
}
}
示例3: apply
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isFirstDayOfMonth();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isFirstDayOfMonth();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isFirstDayOfTheMonth() ");
}
}
示例4: apply
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_TIME:
TimeColumn timeColumn = relation.timeColumn(name);
return timeColumn.isMidnight();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isMidnight();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isMidnight() ");
}
}
示例5: apply
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isTuesday();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isTuesday();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isTuesday() ");
}
}
示例6: apply
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isInDecember();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isInDecember();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isInDecember() ");
}
}
示例7: apply
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isInQ4();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isInQ4();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isInQ4() ");
}
}
示例8: apply
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isInAugust();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isInAugust();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isInAugust() ");
}
}
示例9: FrequentItemset
import tech.tablesaw.api.Table; //导入依赖的package包/类
public FrequentItemset(ShortColumn sets, ShortColumn items, double support) {
Table temp = Table.create("temp");
temp.addColumn(sets.copy());
temp.addColumn(items.copy());
temp.sortAscendingOn(sets.name(), items.name());
ViewGroup baskets = temp.splitOn(temp.column(0));
this.setCount = baskets.size();
int[][] itemsets = new int[setCount][];
int basketIndex = 0;
for (TemporaryView basket : baskets) {
ShortRBTreeSet set = new ShortRBTreeSet(basket.shortColumn(1).data());
int itemIndex = 0;
itemsets[basketIndex] = new int[set.size()];
for (short item : set) {
itemsets[basketIndex][itemIndex] = item;
itemIndex++;
}
basketIndex++;
}
this.model = new FPGrowth(itemsets, support);
}
示例10: main
import tech.tablesaw.api.Table; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Table table = Table.read().csv(CsvReadOptions
.builder("../data/movielens.data")
.separator('\t'));
double supportThreshold = .25;
double confidenceThreshold = .5;
double interestThreshold = .5;
AssociationRuleMining model = new AssociationRuleMining(table.shortColumn("user"), table.shortColumn("movie")
, supportThreshold);
FrequentItemset frequentItemsetModel = new FrequentItemset(table.shortColumn("user"), table.shortColumn
("movie"), supportThreshold);
Object2DoubleOpenHashMap<IntRBTreeSet> confidenceMap = frequentItemsetModel.confidenceMap();
Table interestingRuleTable = model.interest(confidenceThreshold, interestThreshold, confidenceMap);
interestingRuleTable = interestingRuleTable.sortDescendingOn("Interest", "Antecedent");
out(interestingRuleTable);
}
示例11: testAsTable
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Test
public void testAsTable() throws Exception {
Table example = Table.read().csv("../data/KNN_Example_1.csv");
Table[] splits = example.sampleSplit(.5);
Table train = splits[0];
Table test = splits[1];
KNN<double[]> knn = KNN.learn(
DoubleArrays.to2dArray(train.nCol("X"), train.nCol("Y")),
train.shortColumn(2).toIntArray(), 2);
int[] predicted = new int[test.rowCount()];
SortedSet<Object> lableSet = new TreeSet<>(train.shortColumn(2).asSet());
ConfusionMatrix confusion = new StandardConfusionMatrix(lableSet);
for (int row : test) {
double[] data = new double[2];
data[0] = test.floatColumn(0).getFloat(row);
data[1] = test.floatColumn(1).getFloat(row);
predicted[row] = knn.predict(data);
confusion.increment((int) test.shortColumn(2).get(row), predicted[row]);
}
}
示例12: apply
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isInJune();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isInJune();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isInJune() ");
}
}
示例13: apply
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_TIME:
TimeColumn timeColumn = relation.timeColumn(name);
return timeColumn.isAfterNoon();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isAfterNoon();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isAfterNoon() ");
}
}
示例14: apply
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isThursday();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isThursday();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isThursday() ");
}
}
示例15: apply
import tech.tablesaw.api.Table; //导入依赖的package包/类
@Override
public Selection apply(Table relation) {
String name = columnReference().getColumnName();
Column column = relation.column(name);
ColumnType type = column.type();
switch (type) {
case LOCAL_DATE:
DateColumn dateColumn = relation.dateColumn(name);
return dateColumn.isWednesday();
case LOCAL_DATE_TIME:
DateTimeColumn dateTimeColumn = relation.dateTimeColumn(name);
return dateTimeColumn.isWednesday();
default:
throw new UnsupportedOperationException("Columns of type " + type.name() + " do not support the operation "
+ "isWednesday() ");
}
}