Code Monkey home page Code Monkey logo

bst209's People

Contributors

chrystinne avatar dsrestrepo avatar eptehal99 avatar fredrikwhaug avatar joamats avatar kahinasebbane avatar lassehhansen avatar mirkompcr avatar niklasadams avatar nikolajma avatar renataproa avatar tompollard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bst209's Issues

clean up folder and file names (remove capitalization, consistent naming, etc)

There are some inconsistencies in the way folders and files are named, so we should do a quick clean up. We need to be a bit careful when we do this to avoid confusing everyone.

Capitalization is treated differently by different operating systems, which can lead to confusing errors (e.g. a chunk of code works for one person, but not for another). To make things easier, we could convert filenames and foldernames to lowercase.

Issue: Inability to Extract Decision Boundaries for Individual Trees in R Packages

Description:

Currently, there is a limitation in R packages for tree models that prevent the extraction of decision boundaries for individual trees. Unlike Python packages, which allow for easy extraction of decision boundaries, R lacks this functionality. Additionally, there is no existing package in R specifically designed to visualize decision boundaries.

What I have trouble reproducing is a decision boundary plot for individual tress as can be seen here:
https://carpentries-incubator.github.io/machine-learning-trees-python/06-random-forest/index.html

Current Behavior:
In R I am currently only able to visualize decision boundaries for the entire model. Here users are required to manually create decision boundary plots using the ggplot2 package and other relevant packages. The process involves generating a grid of points, predicting the class labels for those points, and then plotting the points with appropriate fill colors to represent the predicted classes. An example can be seen here:

library(ggplot2)
library(gridExtra)
library(rpart)
library(rpart.plot)

# Generate grid of points
grid <- expand.grid(age = seq(min(train_df$age), max(train_df$age), length.out = 100),
                    acutephysiologyscore = seq(min(train_df$acutephysiologyscore), max(train_df$acutephysiologyscore), length.out = 100))

# Predict class label for each point in the grid
grid$prediction <- predict(mdl, newdata = grid, type = "class")

# Create decision boundary plot
decision_boundary_plot <- ggplot(grid, aes(x = age, y = acutephysiologyscore, fill = prediction)) +
  geom_point() +
  geom_tile() +
  scale_color_manual(values = c("blue", "red")) +
  labs(title = "Decision Boundary",
       x = "Age",
       y = "Acute Physiology Score",
       fill = "Predicted Class") +
  theme_classic()

decision_boundary_plot

Desired Enhancement:
It would be beneficial to have an R package that provides a function to easily extract decision boundaries for tree models since this would greatly simplify the process of creating decision boundary plots, eliminating the need for manual implementation using ggplot2 or other general-purpose plotting libraries. Additionally, a dedicated package for visualizing decision boundaries within the individual trees would be beneficial but seems very cumbersome.

Discrepancy in glm training arguments

In the machine-learning-novice

There is a discrepancy between how we train a model with the data:

reg <- glm(y_train ~ ., data = data.frame(cbind(X_train, y_train)), family = binomial())
model <- glm(actualhospitalmortality ~ apachescore , data = train, family = "binomial")
reg <- glm(as.factor(y_train) ~ x_train, family = binomial())

I suggest we all create a train and test data frame like this:



train_df = cbind(x_train, y_train)
test_df = cbind(x_test, y_test)

And all train the models where we have the variable names within the model:

model <- glm(actualhospitalmortality ~ apachescore , data = train_df, family = "binomial")

In this way we are consistent and the formula is also just easier to understand. Also the train_df and test_df are now in the "Data" folder, which can be directly accessed for training.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.