From 712780b4709b9d8f00ba6df4c11751684be279d0 Mon Sep 17 00:00:00 2001 From: valerievossen Date: Thu, 20 Jun 2024 15:00:00 +0200 Subject: [PATCH 1/2] Broken links updates --- .../package-management/packrat.md | 2 +- .../Replicability/package-management/renv.md | 2 +- .../RStudio/R-code-style.md | 2 +- .../RStudio/getting-started-with-R-overview.md | 18 +++++++++--------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/content/topics/Automation/Replicability/package-management/packrat.md b/content/topics/Automation/Replicability/package-management/packrat.md index 29fb7533b..7d6669157 100644 --- a/content/topics/Automation/Replicability/package-management/packrat.md +++ b/content/topics/Automation/Replicability/package-management/packrat.md @@ -14,7 +14,7 @@ aliases: **`Packrat` is now soft-deprecated** It is still maintained, but there will be no new development for it. An updated alternative would be `renv`. -Do you want to learn about it? Visit [this building block](https://tilburgsciencehub.com/topics/automate-and-execute-your-work/reproducible-work/renv/)! +Do you want to learn about it? Visit [this topic](/use/renv)! {{% /warning %}} ## Overview diff --git a/content/topics/Automation/Replicability/package-management/renv.md b/content/topics/Automation/Replicability/package-management/renv.md index fdf85e31e..0057f406f 100644 --- a/content/topics/Automation/Replicability/package-management/renv.md +++ b/content/topics/Automation/Replicability/package-management/renv.md @@ -141,7 +141,7 @@ The R community offers multiple tools to manage dependencies and reproducibility ### Packrat -[Packrat](https://tilburgsciencehub.com/topics/automate-and-execute-your-work/reproducible-work/packrat/) is an earlier solution for managing project-specific R libraries. It helps isolate projects and make them more reproducible by ensuring that each project's library is separate. +[Packrat](/reproduce/packrat) is an earlier solution for managing project-specific R libraries. It helps isolate projects and make them more reproducible by ensuring that each project's library is separate. Nonetheless, while `packrat` was widely used, it has some limitations which `renv` has aimed to address. Furthermore, while it is still maintained, there will be no new development for it. This presents `renv` as a better alternative. diff --git a/content/topics/Computer-Setup/software-installation/RStudio/R-code-style.md b/content/topics/Computer-Setup/software-installation/RStudio/R-code-style.md index 5acc37c67..f1f56bb23 100644 --- a/content/topics/Computer-Setup/software-installation/RStudio/R-code-style.md +++ b/content/topics/Computer-Setup/software-installation/RStudio/R-code-style.md @@ -166,7 +166,7 @@ In general, we follow [Google's R Style Guide](https://google.github.io/stylegui * Do not use dots * Underscores or camel-case are fine. -* See [our conventions for line length](https://tilburgsciencehub.com/topics/develop-your-research-skills/tips/principles-good-coding/) +* See [our conventions for line length](/write/good-code) * We do not require that all functions have a comment block describing their uses. We encourage to do so when the purpose of a function would not be clear or whenever the function will be used outside of the file in which it is defined. diff --git a/content/topics/Computer-Setup/software-installation/RStudio/getting-started-with-R-overview.md b/content/topics/Computer-Setup/software-installation/RStudio/getting-started-with-R-overview.md index 602ea908e..47886cfd1 100644 --- a/content/topics/Computer-Setup/software-installation/RStudio/getting-started-with-R-overview.md +++ b/content/topics/Computer-Setup/software-installation/RStudio/getting-started-with-R-overview.md @@ -33,27 +33,27 @@ Whether you’re looking to start coding for a new career or just as a hobby, pi ## Learn to code -As a first step, [learn how to set up R and RStudio on your local machine](https://tilburgsciencehub.com/topics/configure-your-computer/statistics-and-computation/r/). Next, we have compiled a [comprehensive guide](https://tilburgsciencehub.com/topics/configure-your-computer/statistics-and-computation/r/) with links to useful sources to help you structure your coding learning journey for, it can be daunting to figure out the right resources among tons out there! +As a first step, [learn how to set up R and RStudio on your local machine](/install/r). Next, we have compiled a [comprehensive guide](/learn/r) with links to useful sources to help you structure your coding learning journey for, it can be daunting to figure out the right resources among tons out there! -Furthermore, to polish your coding skills we have put together a succinct coding style [guideline](https://tilburgsciencehub.com/topics/configure-your-computer/statistics-and-computation/r/) to follow. +Furthermore, to polish your coding skills we have put together a succinct coding style [guideline](/write/good-code/r) to follow. ## More on R Packages -Packages are a set of R functions, data and compiled code bundled together and these are stored in a ‘library’. While R comes with a standard set of packages, one may install additional ones whenever required. As your project grows, the variety of packages used also broadens and it's easy to lose track of them. Here’s a brief [code snippet](https://tilburgsciencehub.com/topics/automate-and-execute-your-work/automate-your-workflow/auto-install-r-packages/) to automatically install packages that may not yet be installed on your machine. +Packages are a set of R functions, data and compiled code bundled together and these are stored in a ‘library’. While R comes with a standard set of packages, one may install additional ones whenever required. As your project grows, the variety of packages used also broadens and it's easy to lose track of them. Here’s a brief [code snippet](/install/r-packages) to automatically install packages that may not yet be installed on your machine. In a similar vein, Packrat is an excellent tool to manage your R package library. It is the go-to solution to potential dependency issues between packages when working on multiple projects or when working on the same project using different machines which may have different versions of the packages installed. This helps make R packages isolated, portable and reproducible. -Check out our comprehensive guide to get you started with [Packrat](https://tilburgsciencehub.com/topics/automate-and-execute-your-work/reproducible-work/packrat/) +Check out our comprehensive guide to get you started with [Packrat](/reproduce/packrat) ## Analysis with R: Examples Got a hang of the R syntax and are looking to put your R coding skills to practice with some empirical project? Here are some starter guides and codes of commonly used techniques for descriptive and causal analysis. -- [Run a regression analysis](https://tilburgsciencehub.com/topics/analyze-data/regressions/regression-analysis/) -- [Impact evaluation with DID and RD](https://tilburgsciencehub.com/topics/analyze-data/regressions/impact-evaluation/) -- [Synthetic control analysis](https://tilburgsciencehub.com/topics/analyze-data/regressions/synth-control/) +- [Run a regression analysis](/analyze/regression/) +- [Impact evaluation with DID and RD](/impact/evaluation) +- [Synthetic control analysis](/impact/syntCont) ## Communicate your insights with R @@ -62,5 +62,5 @@ One of the most important and challenging job of a researcher is communicating o Wanna try them out for yourself? Here are some useful resources to help you get started. -- [Build Interactive dashboards with R shiny](https://tilburgsciencehub.com/topics/collaborate-and-share-your-work/publish-on-the-web/shiny-apps/) -- [Publish e-books and interactive articles directly from R](https://tilburgsciencehub.com/topics/collaborate-and-share-your-work/publish-on-the-web/using-r/) +- [Build Interactive dashboards with R shiny](/Shiny/App) +- [Publish e-books and interactive articles directly from R](/make/ebooks) From e2930d5e1def72adcbdbb896a45971b38206d4a8 Mon Sep 17 00:00:00 2001 From: valerievossen Date: Thu, 20 Jun 2024 15:02:49 +0200 Subject: [PATCH 2/2] Add codeblock tags --- .../ml-intro/introduction-to-deep-learning.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/content/topics/Analyze/machine-learning/ml-intro/introduction-to-deep-learning.md b/content/topics/Analyze/machine-learning/ml-intro/introduction-to-deep-learning.md index 4679089cc..c7296e4e0 100644 --- a/content/topics/Analyze/machine-learning/ml-intro/introduction-to-deep-learning.md +++ b/content/topics/Analyze/machine-learning/ml-intro/introduction-to-deep-learning.md @@ -156,6 +156,7 @@ In this section, we load the MNIST dataset and preprocess it for training and te We begin by importing necessary libraries for data manipulation and preprocessing. Then, we load the MNIST dataset using Keras' built-in function `mnist.load_data()`. The dataset consists of 60,000 training images and 10,000 test images, each with their corresponding labels. Next, we preprocess the data by reshaping the input images and normalizing pixel values to a range between 0 and 1. Additionally, we convert the class labels to categorical format using one-hot encoding. +{{% codeblock %}} ```python import numpy as np from keras.datasets import mnist @@ -169,14 +170,17 @@ X_train = X_train.reshape((X_train.shape[0], -1)).astype('float32') / 255 X_test = X_test.reshape((X_test.shape[0], -1)).astype('float32') / 255 y_train = to_categorical(y_train) y_test = to_categorical(y_test) - ``` +{{% /codeblock %}} + + ### Building the model In this section, we construct the neural network model using Keras' Sequential API. We create a Sequential model, which allows us to build a linear stack of layers. The model consists of dense (fully connected) layers, which are interconnected neurons. Each dense layer performs a linear operation on the input data followed by a non-linear activation function. In our model, we use ReLU (Rectified Linear Activation) as the activation function for hidden layers and softmax for the output layer. The `units` parameter specifies the number of neurons in each layer, and `input_shape` defines the shape of the input data for the first layer. -``` +{{% codeblock %}} +```python from keras.models import Sequential from keras.layers import Dense @@ -188,13 +192,16 @@ model.add(Dense(units=64, activation='relu', input_shape=(X_train.shape[1],))) model.add(Dense(units=64, activation='relu')) model.add(Dense(units=10, activation='softmax')) ``` +{{% /codeblock %}} + ### Compiling, fitting and evaluating the model In this section, we compile the model with an optimizer, loss function, and evaluation metric, train the model on the training data, and evaluate its performance on the test data. After building the model, we compile it using the `compile()` method. Here, we specify the optimizer (Adam), loss function (categorical cross-entropy), and evaluation metric (accuracy). Then, we train the model on the training data using the `fit()` method, specifying the number of epochs (iterations over the entire dataset) and batch size (number of samples per gradient update). Finally, we evaluate the trained model on the test data to measure its performance in terms of loss and accuracy. -``` +{{% codeblock %}} +```python # Compiling the model model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy']) @@ -207,6 +214,7 @@ print("Test Loss:", loss) print("Test Accuracy:", accuracy) ``` +{{% /codeblock %}} {{% summary %}} ### What is Deep Learning?