data-modeling

Predict/estimate values using randomForest in R

早过忘川 提交于 2019-12-24 00:57:04
问题 I want to predict values for my Pop_avg field in my unsurveyed areas based on surveyed areas. I am using randomForest based on a suggestion to my earlier question. My surveyed areas: > surveyed <- read.csv("summer_surveyed.csv", header = T) > surveyed_1 <- surveyed[, -c(1,2,3,5,6,7,9,10,11,12,13,15)] > head(surveyed_1, n=1) VEGETATION Pop_avg Acres_1 1 Acer rubrum-Vaccinium corymbosum-Amelanchier spp. 0 27.68884 My unsurveyed areas: > unsurveyed <- read.csv("summer_unsurveyed.csv", header = T

Generate a predicted count distribution from a ZINB model of class glmmTMB

心已入冬 提交于 2019-12-24 00:51:31
问题 In a previous question (No zeros predicted from zeroinfl object in R?) there was a great answer explaining why the predicted count distribution from a pscl package ZINB model using the function zeroinfl included so few zeros, and how one would use the different type arguments of the predict.zeroinfl function to generate a predicted count distribution that better reflected the data. I am running into the same problem, except I am using glmmTMB instead of zeroinfl for a variety of reasons

Bad performance when writing log data to Cassandra with timeuuid as a column name

三世轮回 提交于 2019-12-24 00:42:04
问题 Following the pointers in an ebay tech blog and a datastax developers blog, I model some event log data in Cassandra 1.2. As a partition key, I use “ddmmyyhh|bucket”, where bucket is any number between 0 and the number of nodes in the cluster. The Data model cqlsh:Log> CREATE TABLE transactions (yymmddhh varchar, bucket int, rId int, created timeuuid, data map, PRIMARY KEY((yymmddhh, bucket), created) ); (rId identifies the resource that fired the event.) (map is are key value pairs derived

Generate graphical schema representation from CREATE TABLE SQL

£可爱£侵袭症+ 提交于 2019-12-24 00:39:09
问题 I have a .sql file containing many CREATE TABLE statements. There's no referential specification (MyISAM stuff) but I would enjoy to create different table boxes, and then compose the table relationships by hand. I am using a mac. Is there a free program to do this ? 回答1: Yes, the MySQL Workbench can reverse-engineer a diagram from an SQL script that contains a set of CREATE TABLE statements. Use the menu: File > Import > Reverse Engineer MySQL Create Script... 回答2: Go to SchemaBank, open a

Firebase “symlink” to another node

痞子三分冷 提交于 2019-12-23 23:03:06
问题 In relation to my other question about modelling a real user-facing tree structure (Using firebase tree structure to represent a "document outline" structure directly), I was thinking of putting in place a generic approach to "symlinking", at certain nesting levels, to overcome the 32 nesting levels limitation and the need to fetch all sub-nodes at once. Are there some "best-practices" for "symlinking" in firebase? E.g.: syntax (contents, key-value structure) for a firebase node which would

Modeling products with vastly different sets of needed-to-know information and linking them to lineitems?

醉酒当歌 提交于 2019-12-23 15:07:59
问题 I'm currently working on a site that sells products of varying types that are custom manufactured. I've got your general, standard cart schema: Order has many LineItems, LineItems have one Product, but I've run into a bit of a sticking point: Lets say one of our products is a ball, and one of our products is a box of crayons. While people are creating their order, we end up creating items that could be represented by some psuedocode: Ball: attributes: diameter: decimal color: foreign_ref_to

SQL Server primary key on datetime field

烈酒焚心 提交于 2019-12-23 08:23:16
问题 I'm creating a new table in SQL Server 2005 that needs 2 fields: DateTime and MyValue (Int32). The DateTime field will be unique so I will be setting a unique constraint on it. Which table structure is better and why? MyIndex (PK, int) MyDate (datetime) (IX_UniqueKey) MyValue (int) or MyDate (PK, datetime) MyValue (int) My feeling is that I don't want an artificial PK (MyIndex) in this table because it is unnecessary and because the dates will be unique I will use them to access any record.

trying to figure out the best database schema

有些话、适合烂在心里 提交于 2019-12-23 01:14:09
问题 I want to come up with a generic schema (if possible) to use for a number of different events that I am managing. These events can be weddings, birthday parties, etc. So far I have 3 main tables: Contact Table - the usual info like address, phone, etc. Events Table - a list of events with some info like date, location, etc. EventInfo Table - contains the following fields (not complete but you should get the point): EventID ContactID NumberofAdultsInvited NumberofChildrenInvited Responded (yes

Sequelize.js join table twice using hasMany

倾然丶 夕夏残阳落幕 提交于 2019-12-22 10:43:54
问题 I am using Sequelize.js to do a double join on the same table. I have a set of Team objects and a set of Game objects. A team hasMany Games, so it would have foreign keys in the game table, but there are two teams in every game so i need to join the table twice. What is the best way to do this using the sequelize ORM. Team = sequelize.define('teams',{ name : Sequelize.STRING, location : Sequelize.STRING, }); Game = sequelize.define('games',{ homeTeamId : Sequelize.INTEGER, awayTeamId :

Database Design: how to support multi-lingual site?

假如想象 提交于 2019-12-22 09:35:56
问题 Suppose I have the table: TABLE: product ================================================================= | product_id | name | description | ================================================================= | 1 | Widget 1 | Really nice widget. Buy it now! | ----------------------------------------------------------------- If I want to provide multi-lingual support, what's the best approach to do that? Possible solutions: Add a "language" column to the above table; that'll indicate the