text:
How to get the Width and Height of the screen in JavaScript?

In this article, we are going to discuss how to get the width and height of the screen in JavaScript.

Javascript provides an window.screen object that contains information regarding the user's screen. The information includes height and width, and also many other features.

To find the height and width of the screen you need to use the following read-only properties

• Screen.height − This property is used to get the height of the screen in pixels.
• Screen.width − This property is used to get the width of the screen in pixels.

Syntax

Following is the syntax of the height to get the height and with of a screen respectively −

screen.height;
screen.width;

Example 1

In the following example, the width of the screen is displayed using the screen.width method.

Example 2

In the following example, the height of the screen is displayed using the screen.height method.

Example 3

In the following example we are trying to get the width and height of the screen using the screen.width and screen.height properties −

<!DOCTYPE html>

<title>Get the width and height of the screen</title>

Example 4

Following is another example of this −

<!DOCTYPE html>

<title>Get the width and height of the screen</title>


text:
10,16,2021

 nocaps: novel object captioning at scale2019-09-30   ${\displaystyle \cong }$ Image captioning models have achieved impressive results on datasets containing limited visual concepts and large amounts of paired image-caption training data. However, if these models are to ever function in the wild, a much larger variety of visual concepts must be learned, ideally from less supervision. To encourage the development of image captioning models that can learn visual concepts from alternative data sources, such as object detection datasets, we present the first large-scale benchmark for this task. Dubbed 'nocaps', for novel object captioning at scale, our benchmark consists of 166,100 human-generated captions describing 15,100 images from the OpenImages validation and test sets. The associated training data consists of COCO image-caption pairs, plus OpenImages image-level labels and object bounding boxes. Since OpenImages contains many more classes than COCO, nearly 400 object classes seen in test images have no or very few associated training captions (hence, nocaps). We extend existing novel object captioning models to establish strong baselines for this benchmark and provide analysis to guide future work on this task. Compositional Generalization in Image Captioning2019-09-16   ${\displaystyle \cong }$ Image captioning models are usually evaluated on their ability to describe a held-out set of images, not on their ability to generalize to unseen concepts. We study the problem of compositional generalization, which measures how well a model composes unseen combinations of concepts when describing images. State-of-the-art image captioning models show poor generalization performance on this task. We propose a multi-task model to address the poor performance, that combines caption generation and image--sentence ranking, and uses a decoding mechanism that re-ranks the captions according their similarity to the image. This model is substantially better at generalizing to unseen combinations of concepts compared to state-of-the-art captioning models. Egoshots, an ego-vision life-logging dataset and semantic fidelity metric to evaluate diversity in image captioning models2020-03-27   ${\displaystyle \cong }$ Image captioning models have been able to generate grammatically correct and human understandable sentences. However most of the captions convey limited information as the model used is trained on datasets that do not caption all possible objects existing in everyday life. Due to this lack of prior information most of the captions are biased to only a few objects present in the scene, hence limiting their usage in daily life. In this paper, we attempt to show the biased nature of the currently existing image captioning models and present a new image captioning dataset, Egoshots, consisting of 978 real life images with no captions. We further exploit the state of the art pre-trained image captioning and object recognition networks to annotate our images and show the limitations of existing works. Furthermore, in order to evaluate the quality of the generated captions, we propose a new image captioning metric, object based Semantic Fidelity (SF). Existing image captioning metrics can evaluate a caption only in the presence of their corresponding annotations; however, SF allows evaluating captions generated for images without annotations, making it highly useful for real life generated captions. Image Captioning based on Deep Reinforcement Learning2018-09-13   ${\displaystyle \cong }$ Recently it has shown that the policy-gradient methods for reinforcement learning have been utilized to train deep end-to-end systems on natural language processing tasks. What's more, with the complexity of understanding image content and diverse ways of describing image content in natural language, image captioning has been a challenging problem to deal with. To the best of our knowledge, most state-of-the-art methods follow a pattern of sequential model, such as recurrent neural networks (RNN). However, in this paper, we propose a novel architecture for image captioning with deep reinforcement learning to optimize image captioning tasks. We utilize two networks called "policy network" and "value network" to collaboratively generate the captions of images. The experiments are conducted on Microsoft COCO dataset, and the experimental results have verified the effectiveness of the proposed method. Diverse and Styled Image Captioning Using SVD-Based Mixture of Recurrent Experts2020-07-07   ${\displaystyle \cong }$ With great advances in vision and natural language processing, the generation of image captions becomes a need. In a recent paper, Mathews, Xie and He [1], extended a new model to generate styled captions by separating semantics and style. In continuation of this work, here a new captioning model is developed including an image encoder to extract the features, a mixture of recurrent networks to embed the set of extracted features to a set of words, and a sentence generator that combines the obtained words as a stylized sentence. The resulted system that entitled as Mixture of Recurrent Experts (MoRE), uses a new training algorithm that derives singular value decomposition (SVD) from weighting matrices of Recurrent Neural Networks (RNNs) to increase the diversity of captions. Each decomposition step depends on a distinctive factor based on the number of RNNs in MoRE. Since the used sentence generator gives a stylized language corpus without paired images, our captioning model can do the same. Besides, the styled and diverse captions are extracted without training on a densely labeled or styled dataset. To validate this captioning model, we use Microsoft COCO which is a standard factual image caption dataset. We show that the proposed captioning model can generate a diverse and stylized image captions without the necessity of extra-labeling. The results also show better descriptions in terms of content accuracy. B-SCST: Bayesian Self-Critical Sequence Training for Image Captioning2020-06-28   ${\displaystyle \cong }$ Bayesian deep neural networks (DNNs) can provide a mathematically grounded framework to quantify uncertainty in predictions from image captioning models. We propose a Bayesian variant of policy-gradient based reinforcement learning training technique for image captioning models to directly optimize non-differentiable image captioning quality metrics such as CIDEr-D. We extend the well-known Self-Critical Sequence Training (SCST) approach for image captioning models by incorporating Bayesian inference, and refer to it as B-SCST. The "baseline" for the policy-gradients in B-SCST is generated by averaging predictive quality metrics (CIDEr-D) of the captions drawn from the distribution obtained using a Bayesian DNN model. We infer this predictive distribution using Monte Carlo (MC) dropout approximate variational inference. We show that B-SCST improves CIDEr-D scores on Flickr30k, MS COCO and VizWiz image captioning datasets, compared to the SCST approach. We also provide a study of uncertainty quantification for the predicted captions, and demonstrate that it correlates well with the CIDEr-D scores. To our knowledge, this is the first such analysis, and it can improve the interpretability of image captioning model outputs, which is critical for practical applications. Length-Controllable Image Captioning2020-07-18   ${\displaystyle \cong }$ The last decade has witnessed remarkable progress in the image captioning task; however, most existing methods cannot control their captions, \emph{e.g.}, choosing to describe the image either roughly or in detail. In this paper, we propose to use a simple length level embedding to endow them with this ability. Moreover, due to their autoregressive nature, the computational complexity of existing models increases linearly as the length of the generated captions grows. Thus, we further devise a non-autoregressive image captioning approach that can generate captions in a length-irrelevant complexity. We verify the merit of the proposed length level embedding on three models: two state-of-the-art (SOTA) autoregressive models with different types of decoder, as well as our proposed non-autoregressive model, to show its generalization ability. In the experiments, our length-controllable image captioning models not only achieve SOTA performance on the challenging MS COCO dataset but also generate length-controllable and diverse image captions. Specifically, our non-autoregressive model outperforms the autoregressive baselines in terms of controllability and diversity, and also significantly improves the decoding efficiency for long captions. Our code and models are released at \textcolor{magenta}{\texttt{https://github.com/bearcatt/LaBERT}}. Alleviating Noisy Data in Image Captioning with Cooperative Distillation2020-12-21   ${\displaystyle \cong }$ Image captioning systems have made substantial progress, largely due to the availability of curated datasets like Microsoft COCO or Vizwiz that have accurate descriptions of their corresponding images. Unfortunately, scarce availability of such cleanly labeled data results in trained algorithms producing captions that can be terse and idiosyncratically specific to details in the image. We propose a new technique, cooperative distillation that combines clean curated datasets with the web-scale automatically extracted captions of the Google Conceptual Captions dataset (GCC), which can have poor descriptions of images, but is abundant in size and therefore provides a rich vocabulary resulting in more expressive captions. A Comprehensive Survey of Deep Learning for Image Captioning2018-10-14   ${\displaystyle \cong }$ Generating a description of an image is called image captioning. Image captioning requires to recognize the important objects, their attributes and their relationships in an image. It also needs to generate syntactically and semantically correct sentences. Deep learning-based techniques are capable of handling the complexities and challenges of image captioning. In this survey paper, we aim to present a comprehensive review of existing deep learning-based image captioning techniques. We discuss the foundation of the techniques to analyze their performances, strengths and limitations. We also discuss the datasets and the evaluation metrics popularly used in deep learning based automatic image captioning. XGPT: Cross-modal Generative Pre-Training for Image Captioning2020-03-04   ${\displaystyle \cong }$ While many BERT-based cross-modal pre-trained models produce excellent results on downstream understanding tasks like image-text retrieval and VQA, they cannot be applied to generation tasks directly. In this paper, we propose XGPT, a new method of Cross-modal Generative Pre-Training for Image Captioning that is designed to pre-train text-to-image caption generators through three novel generation tasks, including Image-conditioned Masked Language Modeling (IMLM), Image-conditioned Denoising Autoencoding (IDA), and Text-conditioned Image Feature Generation (TIFG). As a result, the pre-trained XGPT can be fine-tuned without any task-specific architecture modifications to create state-of-the-art models for image captioning. Experiments show that XGPT obtains new state-of-the-art results on the benchmark datasets, including COCO Captions and Flickr30k Captions. We also use XGPT to generate new image captions as data augmentation for the image retrieval task and achieve significant improvement on all recall metrics. Fusion Models for Improved Visual Captioning2020-10-28   ${\displaystyle \cong }$ Visual captioning aims to generate textual descriptions given images. Traditionally, the captioning models are trained on human annotated datasets such as Flickr30k and MS-COCO, which are limited in size and diversity. This limitation hinders the generalization capabilities of these models while also rendering them to often make mistakes. Language models can, however, be trained on vast amounts of freely available unlabelled data and have recently emerged as successful language encoders and coherent text generators. Meanwhile, several unimodal and multimodal fusion techniques have been proven to work well for natural language generation and automatic speech recognition. Building on these recent developments, and with an aim of improving the quality of generated captions, the contribution of our work in this paper is two-fold: First, we propose a generic multimodal model fusion framework for caption generation as well as emendation where we utilize different fusion strategies to integrate a pretrained Auxiliary Language Model (AuxLM) within the traditional encoder-decoder visual captioning frameworks. Next, we employ the same fusion strategies to integrate a pretrained Masked Language Model (MLM), namely BERT, with a visual captioning model, viz. Show, Attend, and Tell, for emending both syntactic and semantic errors in captions. Our caption emendation experiments on three benchmark image captioning datasets, viz. Flickr8k, Flickr30k, and MSCOCO, show improvements over the baseline, indicating the usefulness of our proposed multimodal fusion strategies. Further, we perform a preliminary qualitative analysis on the emended captions and identify error categories based on the type of corrections. SD-RSIC: Summarization Driven Deep Remote Sensing Image Captioning2020-06-15   ${\displaystyle \cong }$ Deep neural networks (DNNs) have been recently found popular for image captioning problems in remote sensing (RS). Existing DNN based approaches rely on the availability of a training set made up of a high number of RS images with their captions. However, captions of training images may contain redundant information (they can be repetitive or semantically similar to each other), resulting in information deficiency while learning a mapping from image domain to language domain. To overcome this limitation, in this paper we present a novel Summarization Driven Remote Sensing Image Captioning (SD-RSIC) approach. The proposed approach consists of three main steps. The first step obtains the standard image captions by jointly exploiting convolutional neural networks (CNNs) with long short-term memory (LSTM) networks. The second step, unlike the existing RS image captioning methods, summarizes the ground-truth captions of each training image into a single caption by exploiting sequence to sequence neural networks and eliminates the redundancy present in the training set. The third step automatically defines the adaptive weights associated to each RS image to combine the standard captions with the summarized captions based on the semantic content of the image. This is achieved by a novel adaptive weighting strategy defined in the context of LSTM networks. Experimental results obtained on the RSCID, UCM-Captions and Sydney-Captions datasets show the effectiveness of the proposed approach compared to the state-of-the-art RS image captioning approaches. RATT: Recurrent Attention to Transient Tasks for Continual Image Captioning2020-07-13   ${\displaystyle \cong }$ Research on continual learning has led to a variety of approaches to mitigating catastrophic forgetting in feed-forward classification networks. Until now surprisingly little attention has been focused on continual learning of recurrent models applied to problems like image captioning. In this paper we take a systematic look at continual learning of LSTM-based models for image captioning. We propose an attention-based approach that explicitly accommodates the transient nature of vocabularies in continual image captioning tasks -- i.e. that task vocabularies are not disjoint. We call our method Recurrent Attention to Transient Tasks (RATT), and also show how to adapt continual learning approaches based on weight egularization and knowledge distillation to recurrent continual learning problems. We apply our approaches to incremental image captioning problem on two new continual learning benchmarks we define using the MS-COCO and Flickr30 datasets. Our results demonstrate that RATT is able to sequentially learn five captioning tasks while incurring no forgetting of previously learned ones. Image Captioning as an Assistive Technology: Lessons Learned from VizWiz 2020 Challenge2020-12-21   ${\displaystyle \cong }$ Image captioning has recently demonstrated impressive progress largely owing to the introduction of neural network algorithms trained on curated dataset like MS-COCO. Often work in this field is motivated by the promise of deployment of captioning systems in practical applications. However, the scarcity of data and contexts in many competition datasets renders the utility of systems trained on these datasets limited as an assistive technology in real-world settings, such as helping visually impaired people navigate and accomplish everyday tasks. This gap motivated the introduction of the novel VizWiz dataset, which consists of images taken by the visually impaired and captions that have useful, task-oriented information. In an attempt to help the machine learning computer vision field realize its promise of producing technologies that have positive social impact, the curators of the VizWiz dataset host several competitions, including one for image captioning. This work details the theory and engineering from our winning submission to the 2020 captioning competition. Our work provides a step towards improved assistive image captioning systems. Aligning Multilingual Word Embeddings for Cross-Modal Retrieval Task2019-10-08   ${\displaystyle \cong }$ In this paper, we propose a new approach to learn multimodal multilingual embeddings for matching images and their relevant captions in two languages. We combine two existing objective functions to make images and captions close in a joint embedding space while adapting the alignment of word embeddings between existing languages in our model. We show that our approach enables better generalization, achieving state-of-the-art performance in text-to-image and image-to-text retrieval task, and caption-caption similarity task. Two multimodal multilingual datasets are used for evaluation: Multi30k with German and English captions and Microsoft-COCO with English and Japanese captions. Diverse Image Captioning with Context-Object Split Latent Spaces2020-11-02   ${\displaystyle \cong }$ Diverse image captioning models aim to learn one-to-many mappings that are innate to cross-domain datasets, such as of images and texts. Current methods for this task are based on generative latent variable models, e.g. VAEs with structured latent spaces. Yet, the amount of multimodality captured by prior work is limited to that of the paired training data -- the true diversity of the underlying generative process is not fully captured. To address this limitation, we leverage the contextual descriptions in the dataset that explain similar contexts in different visual scenes. To this end, we introduce a novel factorization of the latent space, termed context-object split, to model diversity in contextual descriptions across images and texts within the dataset. Our framework not only enables diverse captioning through context-based pseudo supervision, but extends this to images with novel objects and without paired captions in the training data. We evaluate our COS-CVAE approach on the standard COCO dataset and on the held-out COCO dataset consisting of images with novel objects, showing significant gains in accuracy and diversity. Attention Beam: An Image Captioning Approach2020-11-03   ${\displaystyle \cong }$ The aim of image captioning is to generate textual description of a given image. Though seemingly an easy task for humans, it is challenging for machines as it requires the ability to comprehend the image (computer vision) and consequently generate a human-like description for the image (natural language understanding). In recent times, encoder-decoder based architectures have achieved state-of-the-art results for image captioning. Here, we present a heuristic of beam search on top of the encoder-decoder based architecture that gives better quality captions on three benchmark datasets: Flickr8k, Flickr30k and MS COCO. Multi-task Regularization Based on Infrequent Classes for Audio Captioning2020-07-09   ${\displaystyle \cong }$ Audio captioning is a multi-modal task, focusing on using natural language for describing the contents of general audio. Most audio captioning methods are based on deep neural networks, employing an encoder-decoder scheme and a dataset with audio clips and corresponding natural language descriptions (i.e. captions). A significant challenge for audio captioning is the distribution of words in the captions: some words are very frequent but acoustically non-informative, i.e. the function words (e.g. "a", "the"), and other words are infrequent but informative, i.e. the content words (e.g. adjectives, nouns). In this paper we propose two methods to mitigate this class imbalance problem. First, in an autoencoder setting for audio captioning, we weigh each word's contribution to the training loss inversely proportional to its number of occurrences in the whole dataset. Secondly, in addition to multi-class, word-level audio captioning task, we define a multi-label side task based on clip-level content word detection by training a separate decoder. We use the loss from the second task to regularize the jointly trained encoder for the audio captioning task. We evaluate our method using Clotho, a recently published, wide-scale audio captioning dataset, and our results show an increase of 37\% relative improvement with SPIDEr metric over the baseline method. Exploring and Distilling Cross-Modal Information for Image Captioning2020-03-15   ${\displaystyle \cong }$ Recently, attention-based encoder-decoder models have been used extensively in image captioning. Yet there is still great difficulty for the current methods to achieve deep image understanding. In this work, we argue that such understanding requires visual attention to correlated image regions and semantic attention to coherent attributes of interest. Based on the Transformer, to perform effective attention, we explore image captioning from a cross-modal perspective and propose the Global-and-Local Information Exploring-and-Distilling approach that explores and distills the source information in vision and language. It globally provides the aspect vector, a spatial and relational representation of images based on caption contexts, through the extraction of salient region groupings and attribute collocations, and locally extracts the fine-grained regions and attributes in reference to the aspect vector for word selection. Our Transformer-based model achieves a CIDEr score of 129.3 in offline COCO evaluation on the COCO testing set with remarkable efficiency in terms of accuracy, speed, and parameter budget. Compare and Reweight: Distinctive Image Captioning Using Similar Images Sets2020-07-14   ${\displaystyle \cong }$ A wide range of image captioning models has been developed, achieving significant improvement based on popular metrics, such as BLEU, CIDEr, and SPICE. However, although the generated captions can accurately describe the image, they are generic for similar images and lack distinctiveness, i.e., cannot properly describe the uniqueness of each image. In this paper, we aim to improve the distinctiveness of image captions through training with sets of similar images. First, we propose a distinctiveness metric -- between-set CIDEr (CIDErBtw) to evaluate the distinctiveness of a caption with respect to those of similar images. Our metric shows that the human annotations of each image are not equivalent based on distinctiveness. Thus we propose several new training strategies to encourage the distinctiveness of the generated caption for each image, which are based on using CIDErBtw in a weighted loss function or as a reinforcement learning reward. Finally, extensive experiments are conducted, showing that our proposed approach significantly improves both distinctiveness (as measured by CIDErBtw and retrieval metrics) and accuracy (e.g., as measured by CIDEr) for a wide variety of image captioning baselines. These results are further confirmed through a user study.

format: plain


text:
Angular velocity after collision?

1. Aug 30, 2015

naianator

1. The problem statement, all variables and given/known data

A small circular block of mass M traveling with a speed v on a frictionless table collides and sticks to the end of a thin rod of with length D and mass M. The picture shows a top down view of the block and rod on the frictionless table. What is the rod's angular velocity after the collision? Express your answer in some combination of M, v, and D.

2. Relevant equations
conservation of angular momentum
I_cm = M*D^2/12
I_point mass = Mr^2

3. The attempt at a solution
So I guess the part that I'm struggling with is where to put the reference point. I tried the center of mass first:

L_i = M*v*D/2 + I*omega
and since omega_i = 0 its just
L_i = M*v*D/2

L_f = omega(I_cm + I_point mass) = omega(M*D^2/12+M*D^2/4)

and using conservation of angular momentum:
M*v*D/2 = omega(M*D^2/12+M*D^2/4)

M*v*D/2 = omega*M*D^2/3

omega = 3*v/(2*D)

I tried the same thing with the upper end of the rod and got 3*v/(4*D) so I'm obviously doing something wrong. Do I have to include the translation of the center of mass? If I do I'm not quite sure how.

2. Aug 30, 2015

TSny

OK, just to be clear, it appears that you are choosing your origin to be at the initial position of the center of mass of the rod, not the center of mass of the whole system.

OK
No, the equation above isn't correct.
Yes. Just after the collision, the center of the rod will have a horizontal "recoil" velocity Vc,f. The velocity of the point mass just after the collision will have a contribution from Vc,f and a contribution from ω.

Both Vc,f and ω are unknowns. So, you're going to need another equation. Can you think of another conservation principle that is applicable?

Note: there is a tool bar for formatting. The Σ icon will bring up some mathematical symbols.

3. Aug 30, 2015

naianator

Conservation of energy right? Or can you use conservation of linear momentum to find the velocity of the center of mass?

4. Aug 30, 2015

TSny

Is the collision elastic or inelastic?

5. Aug 30, 2015

naianator

inelastic, so I should use conservation of linear momentum?

6. Aug 30, 2015

naianator

in which case v_f = v/2 but how do i incorporate that into the angular momentum equation?

7. Aug 30, 2015

TSny

It's not that easy to get the final velocity of the center of the rod, Vc,f. You'll need to set up the linear momentum equation carefully.

8. Aug 30, 2015

naianator

p_i = M*v right?
and p_f = M*v'+M*v' = 2*M*v'
What am i doing wrong?

9. Aug 30, 2015

haruspex

In general, a reference point for conservation of angular momentum should be either a fixed point or the mass centre of the system. You appear to have taken the mass centre of the rod, but not as a fixed point. Take it it as fixed at the initial position of the rod's mass centre. Then, as TSny says, you get a post-collision contribution from the linear motion of the disc. You can treat that either as purely linear motion, or as the linear motion of the rod's centre plus a contribution from the rotation of the rod.

Although it's easy to find the post-collision velocity of the system's mass centre, it is, as you found, awkward to use. I would introduce an unknown for the post-collision velocity of the rod's mass centre. The velocity of the disc can easily be expressed in terms of that and the rotation rate. The two conservation equations allow you to solve for those two unknowns.
I believe this is the path TSny laid out.

10. Aug 30, 2015

naianator

I'm not sure I completely understand, if I take the center of mass of the system 3*D/4 as the reference point will the linear conservation be less awkward to use?

11. Aug 30, 2015

TSny

Yes, I was considering the origin as a fixed point that coincides with the initial location of the center of the rod.

12. Aug 30, 2015

haruspex

No, I'm saying that I regard it generally as simpler not to bother working out where the mass centre of the system is. I just assign a variable to the velocity of each component. But it's a matter of taste.

13. Aug 30, 2015

naianator

so how do I find the final velocity?

14. Aug 30, 2015

TSny

Try to express the final linear momentum of the system in terms of M, Vc,f, ω, and L.

15. Aug 30, 2015

naianator

So would it be correct to say that L_f = m*D^2/3*ω+2*m*D/4*v_f

16. Aug 30, 2015

haruspex

It depends... what's vf here?

17. Aug 30, 2015

naianator

the final velocity of the center of mass of the system

18. Aug 30, 2015

haruspex

Then the equation is wrong. $\omega \frac D2$ is the velocity of the disc relative to what?

19. Aug 30, 2015

naianator

the center of the rod right?

20. Aug 30, 2015

naianator

m*v_cf+m*ω*d/2?


text:
New Contributor

# Help with calculated column formulas

HI!

I am trying to do a calculated column that inserts text when another column's total in between a set of numbers. Can someone help me with the formula? Can't seem to make it work.

Calculated Column is Overall Score

If the Total Column (another calculated column) is:

Between 1-7.99 insert Needs Improvement to calculated column Overall Score

Between 8-9.99 insert Meets Expectations to calculated column Overall Score

Between 10-12.99 insert Strong to calculated column Overall Score

Between 13-15 insert Outstanding to calculated column Overall Score

3 Replies

# Re: Help with calculated column formulas

=IF(AND(Total>=1,Total<=7.99),"Needs Improvement",IF(AND(Total>=8,Total<=9.99),"Meets Expectations",IF(AND(Total>=10,Total<=12.99),"Strong",IF(AND(Total>=13,Total<=15),"Outstanding",""))))

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

# Re: Help with calculated column formulas

Thank you!
I copy and pasted into the formula box and there is an error. I am trying to attach a pic but it isn't working for some reason.

# Re: Help with calculated column formulas

The "total" column is a sum formula, is that an issue?


text:
Chemistry: Atoms First 2e

# 2.2Evolution of Atomic Theory

Chemistry: Atoms First 2e2.2 Evolution of Atomic Theory
By the end of this section, you will be able to:
• Outline milestones in the development of modern atomic theory
• Summarize and interpret the results of the experiments of Thomson, Millikan, and Rutherford
• Describe the three subatomic particles that compose atoms
• Define isotopes and give examples for several elements

If matter is composed of atoms, what are atoms composed of? Are they the smallest particles, or is there something smaller? In the late 1800s, a number of scientists interested in questions like these investigated the electrical discharges that could be produced in low-pressure gases, with the most significant discovery made by English physicist J. J. Thomson using a cathode ray tube. This apparatus consisted of a sealed glass tube from which almost all the air had been removed; the tube contained two metal electrodes. When high voltage was applied across the electrodes, a visible beam called a cathode ray appeared between them. This beam was deflected toward the positive charge and away from the negative charge, and was produced in the same way with identical properties when different metals were used for the electrodes. In similar experiments, the ray was simultaneously deflected by an applied magnetic field, and measurements of the extent of deflection and the magnetic field strength allowed Thomson to calculate the charge-to-mass ratio of the cathode ray particles. The results of these measurements indicated that these particles were much lighter than atoms (Figure 2.6).

Figure 2.6 (a) J. J. Thomson produced a visible beam in a cathode ray tube. (b) This is an early cathode ray tube, invented in 1897 by Ferdinand Braun. (c) In the cathode ray, the beam (shown in yellow) comes from the cathode and is accelerated past the anode toward a fluorescent scale at the end of the tube. Simultaneous deflections by applied electric and magnetic fields permitted Thomson to calculate the mass-to-charge ratio of the particles composing the cathode ray. (credit a: modification of work by Nobel Foundation; credit b: modification of work by Eugen Nesper; credit c: modification of work by “Kurzon”/Wikimedia Commons)

Based on his observations, here is what Thomson proposed and why: The particles are attracted by positive (+) charges and repelled by negative (−) charges, so they must be negatively charged (like charges repel and unlike charges attract); they are less massive than atoms and indistinguishable, regardless of the source material, so they must be fundamental, subatomic constituents of all atoms. Although controversial at the time, Thomson’s idea was gradually accepted, and his cathode ray particle is what we now call an electron, a negatively charged, subatomic particle with a mass more than one thousand-times less that of an atom. The term “electron” was coined in 1891 by Irish physicist George Stoney, from “electric ion.”

In 1909, more information about the electron was uncovered by American physicist Robert A. Millikan via his “oil drop” experiments. Millikan created microscopic oil droplets, which could be electrically charged by friction as they formed or by using X-rays. These droplets initially fell due to gravity, but their downward progress could be slowed or even reversed by an electric field lower in the apparatus. By adjusting the electric field strength and making careful measurements and appropriate calculations, Millikan was able to determine the charge on individual drops (Figure 2.7).

Figure 2.7 Millikan’s experiment measured the charge of individual oil drops. The tabulated data are examples of a few possible values.

Looking at the charge data that Millikan gathered, you may have recognized that the charge of an oil droplet is always a multiple of a specific charge, 1.6 $××$ 10−19 C. Millikan concluded that this value must therefore be a fundamental charge—the charge of a single electron—with his measured charges due to an excess of one electron (1 times 1.6 $××$ 10−19 C), two electrons (2 times 1.6 $××$ 10−19 C), three electrons (3 times 1.6 $××$ 10−19 C), and so on, on a given oil droplet. Since the charge of an electron was now known due to Millikan’s research, and the charge-to-mass ratio was already known due to Thomson’s research (1.759 $××$ 1011 C/kg), it only required a simple calculation to determine the mass of the electron as well.

$Mass of electron=1.602×10−19C×1kg1.759×1011C=9.107×10−31kgMass of electron=1.602×10−19C×1kg1.759×1011C=9.107×10−31kg$

Scientists had now established that the atom was not indivisible as Dalton had believed, and due to the work of Thomson, Millikan, and others, the charge and mass of the negative, subatomic particles—the electrons—were known. However, the positively charged part of an atom was not yet well understood. In 1904, Thomson proposed the “plum pudding” model of atoms, which described a positively charged mass with an equal amount of negative charge in the form of electrons embedded in it, since all atoms are electrically neutral. A competing model had been proposed in 1903 by Hantaro Nagaoka, who postulated a Saturn-like atom, consisting of a positively charged sphere surrounded by a halo of electrons (Figure 2.8).

Figure 2.8 (a) Thomson suggested that atoms resembled plum pudding, an English dessert consisting of moist cake with embedded raisins (“plums”). (b) Nagaoka proposed that atoms resembled the planet Saturn, with a ring of electrons surrounding a positive “planet.” (credit a: modification of work by “Man vyi”/Wikimedia Commons; credit b: modification of work by “NASA”/Wikimedia Commons)

The next major development in understanding the atom came from Ernest Rutherford, a physicist from New Zealand who largely spent his scientific career in Canada and England. He performed a series of experiments using a beam of high-speed, positively charged alpha particles (α particles) that were produced by the radioactive decay of radium; α particles consist of two protons and two neutrons (you will learn more about radioactive decay in the chapter on nuclear chemistry). Rutherford and his colleagues Hans Geiger (later famous for the Geiger counter) and Ernest Marsden aimed a beam of α particles, the source of which was embedded in a lead block to absorb most of the radiation, at a very thin piece of gold foil and examined the resultant scattering of the α particles using a luminescent screen that glowed briefly where hit by an α particle.

What did they discover? Most particles passed right through the foil without being deflected at all. However, some were diverted slightly, and a very small number were deflected almost straight back toward the source (Figure 2.9). Rutherford described finding these results: “It was quite the most incredible event that has ever happened to me in my life. It was almost as incredible as if you fired a 15-inch shell at a piece of tissue paper and it came back and hit you.”1

Figure 2.9 Geiger and Rutherford fired α particles at a piece of gold foil and detected where those particles went, as shown in this schematic diagram of their experiment. Most of the particles passed straight through the foil, but a few were deflected slightly and a very small number were significantly deflected.

Here is what Rutherford deduced: Because most of the fast-moving α particles passed through the gold atoms undeflected, they must have traveled through essentially empty space inside the atom. Alpha particles are positively charged, so deflections arose when they encountered another positive charge (like charges repel each other). Since like charges repel one another, the few positively charged α particles that changed paths abruptly must have hit, or closely approached, another body that also had a highly concentrated, positive charge. Since the deflections occurred a small fraction of the time, this charge only occupied a small amount of the space in the gold foil. Analyzing a series of such experiments in detail, Rutherford drew two conclusions:

1. The volume occupied by an atom must consist of a large amount of empty space.
2. A small, relatively heavy, positively charged body, the nucleus, must be at the center of each atom.

This analysis led Rutherford to propose a model in which an atom consists of a very small, positively charged nucleus, in which most of the mass of the atom is concentrated, surrounded by the negatively charged electrons, so that the atom is electrically neutral (Figure 2.10). After many more experiments, Rutherford also discovered that the nuclei of other elements contain the hydrogen nucleus as a “building block,” and he named this more fundamental particle the proton, the positively charged, subatomic particle found in the nucleus. With one addition, which you will learn next, this nuclear model of the atom, proposed over a century ago, is still used today.

Figure 2.10 The α particles are deflected only when they collide with or pass close to the much heavier, positively charged gold nucleus. Because the nucleus is very small compared to the size of an atom, very few α particles are deflected. Most pass through the relatively large region occupied by electrons, which are too light to deflect the rapidly moving particles.

Another important finding was the discovery of isotopes. During the early 1900s, scientists identified several substances that appeared to be new elements, isolating them from radioactive ores. For example, a “new element” produced by the radioactive decay of thorium was initially given the name mesothorium. However, a more detailed analysis showed that mesothorium was chemically identical to radium (another decay product), despite having a different atomic mass. This result, along with similar findings for other elements, led the English chemist Frederick Soddy to realize that an element could have types of atoms with different masses that were chemically indistinguishable. These different types are called isotopes—atoms of the same element that differ in mass. Soddy was awarded the Nobel Prize in Chemistry in 1921 for this discovery.

One puzzle remained: The nucleus was known to contain almost all of the mass of an atom, with the number of protons only providing half, or less, of that mass. Different proposals were made to explain what constituted the remaining mass, including the existence of neutral particles in the nucleus. As you might expect, detecting uncharged particles is very challenging, and it was not until 1932 that James Chadwick found evidence of neutrons, uncharged, subatomic particles with a mass approximately the same as that of protons. The existence of the neutron also explained isotopes: They differ in mass because they have different numbers of neutrons, but they are chemically identical because they have the same number of protons. This will be explained in more detail later.

### Footnotes

• 1 Ernest Rutherford, “The Development of the Theory of Atomic Structure,” ed. J. A. Ratcliffe, in Background to Modern Science, eds. Joseph Needham and Walter Pagel, (Cambridge, UK: Cambridge University Press, 1938), 61–74. Accessed September 22, 2014, https://ia600508.us.archive.org/3/items/backgroundtomode032734mbp/backgroundtomode032734mbp.pdf.


text:
# 网络科学模型¶

[email protected]

The random network model

# Erdös-Rényi model (1960)¶

Definition: A random graph is a graph of N nodes where each pair of nodes is connected by probability p.

### G(N, L) Model¶

N lableled nodes are connected with L randomly placed links. Erdös-Rényi(1959)

### G(N, p) Model¶

Each pair of N labeled nodes is connected with probability p. Gilbert (1959)

## To construct a random network:¶

• 1) Start with $N$ isolated nodes.
• 2) Select a node pair and generate a random number between 0 and 1. If the number exceeds $p$, connect the selected node pair with a link, otherwise leave them disconnected.
• 3) Repeat step (2) for each of the $\frac{N(N-1)}{2}$ node pairs.

The probability that a random network has exactly $L$ links and $N$ nodes:

# $p_L = C_{\frac{N(N-1)}{2}}^L p^L (1-p)^{\frac{N(N-1)}{2} -L}$¶

$P_L$is a binomial distribution, the expected number of links in a random graph is

# $= \sum_{L = 0}^{\frac{N(N-1)}{2}} L p_L = p \frac{N(N-1)}{2}$

$L_{max} = \frac{N(N-1)}{2}$

Thus, the average degree of a random network is :

# $= \frac{2}{N} = p(N-1)$

$k_{max} = N-1$

# In summary:¶

• the number of links in a random network varies between realizations.
• Its expected value is determined by N and p.
• If we increase p a random network becomes denser:
• The average number of links increase linearly from = 0 to Lmax
• and the average degree of a node increases from = 0 to = N-1.

# Degree Distribution¶

In a given realization of a random network some nodes gain numerous links, while others acquire only a few or no links. These differences are captured by the degree distribution, $p_k$.

# $p_k$ is the probability that a randomly chosen node has degree $k$.¶

In a random network the probability that node i has exactly $k$ links is the product of three terms:

• The probability that k of its links are present, or $p^k$.
• $k_{max} = N-1$, The probability that the remaining (N-1-k) links are missing, or $(1-p)^{N-1-k}$
• The number of ways we can select $k$ links from $N- 1$ potential links a node can have, or $C_{N-1}^k$

Consequently the degree distribution of a random network is:

# $p_k = C_{N-1}^k p^k (1-p)^{N-1-k}$¶

which follows the binomial distribution. The shape of this distribution depends on the system size $N$ and the probability $p$.

# POISSON DISTRIBUTION¶

Most real networks are sparse, meaning that for them ≪ N. In this limit the degree distribution is well approximated by the Poisson distribution

The evolution of random networks The relative size of the giant component in function of the average degree $$in the Erdős-Rényi model. The figure illustrates the phase tranisition at  = 1, responsible for the emergence of a giant component with nonzero N_G. REAL NETWORKS ARE SUPERCRITICAL # The small world phenomenon¶ also known as six degrees of separation, has long fascinated the general public. It states that if you choose any two individuals anywhere on Earth, you will find a path of at most six acquaintances between them. • What does short (or small) mean, i.e. short compared to what? • How do we explain the existence of these short distances? # Consider a random network with average degree$$.

A node i in this network has on average:

• $$nodes at distance one (d=1). • ^2 nodes at distance two (d=2). • ^3 nodes at distance three (d =3). • ... • ^d nodes at distance d. # 为什么？¶ # 从For循环的角度理解¶ • 从这个节点i走一步，到达他/她的$$个朋友
• 从节点i走两步，先到他/她的$$个朋友，再到每个朋友的$$个朋友。
• 。。。

for $≈ 1,000$, which is the estimated number of acquaintences an individual has, we expect $10^6$ individuals at distance two and about a billion, i.e. almost the whole earth’s population, at distance three from us.

$N(d) = 1 + + ^2 + ^3 + ...+ ^d = \frac{^{d+1}-1}{-1}$

# 网络直径¶

$N(d_{max}) = N$可以计算最大的距离，或者说网络直径。

• The local clustering coefficient of a node is independent of the node’s degree.

# In summary¶

• we find that the random network model does not capture the clustering of real networks.
• Instead real networks have a much higher clustering coefficient than expected for a random network of similar N and L.
• An extension of the random network model proposed by Watts and Strogatz addresses the coexistence of high $$and the small world property. • It fails to explain, however, why high-degree nodes have a smaller clustering coefficient than low-degree nodes. # WS模型 （1998）¶ Duncan Watts and Steven Strogatz proposed an extension of the random network model motivated by two observations： • (a) Small World Property： In real networks the average distance between two nodes depends logarithmically on N • (b) High Clustering： The average clustering coefficient of real networks is much high- er than expected for a random network of similar N and L • a regular lattice has high clustering but lacks the small-world phenomenon. • and a random network has low clustering, but displays the small-world property. ## Numerical simulations indicate that for a range of rewiring parameters the model's average path length is low but the clustering coefficient is high¶ hence reproducing the coexistence of high clustering and small-world phenomena D. J. Watts and S. H. Strogatz. Collective dynamics of ‘small-world’ networks. Nature, 393: 409–10, 1998. • The dependence of the average path length d(p) and clustering coefficient$$ on the rewiring parameter $p$.

• Note that $d(p)$ and $$have been normalized by d(0) and$$ obtained for a regular lattice.

• The rapid drop in $d(p)$ signals the onset of the small-world phenomenon.
• During this drop, $$remains high. • Hence in the range 0.001 D. J. Watts and S. H. Strogatz. Collective dynamics of ‘small-world’ networks. Nature, 393: 409–10, 1998. # In summary¶ • we find that the random network model does not capture the clustering of real networks. • Instead real networks have a much higher clustering coefficient than expected for a random network of similar N and L. • An extension of the random network model proposed by Watts and Strogatz [1998] addresses the coexistence of high and the small world property. • It fails to explain, however, why high-degree nodes have a smaller clustering coefficient than low-degree nodes. # REAL NETWORKS ARE NOT POISSON¶ # BA模型 （1999）¶ Barabasi (1999) Emergence of scaling in random networks.Science-509-12 ### Scaling-Free¶ ### The Preferential Attachment Model¶ # 无标度的意义¶ 度分布的n阶矩被定义为：  = \sum_{k_{min}}^{k_{max}}k^np_k = \int_{k_{min}}^{k_{max}}k^np_kdk  （1） 低阶矩具有明确的统计意义： • n = 1的时候，一阶矩是$$，即平均度。
• n = 2的时候，二阶矩是$$，可以帮助计算方差  \delta^2 = - ^{2} ，测量了度的离散程度（the spread in the degrees）。 • n = 3的时候，三阶矩是$$, 决定了度分布的偏度（skewness），测量了$p_k$围绕着$$的对称性。 对于无标度网络而言，满足幂律分布： p(k) = Ck^{-\gamma} （2） 由公式（1）和（2）可以得到：  = \int_{k_{min}}^{k_{max}}k^np_kdk = C \frac{k_{max}^{n- \gamma +1} - k_{min}^{n - \gamma +1}}{n - \gamma + 1}  （3） 可以使用wolframalpha的积分计算器积分来进行简单验证，例如x^(n-r)dx从10到100积分 网页链接：http://www.wolframalpha.com/input/?i=integrate+x%5E%28n-r%29+dx+from+10+to+100 显然： • 当n - \gamma +1 <= 0时，随着k_{max}增加，$$k_{max}^{n- \gamma +1} \rightarrow 0$。所有满足$n <= \gamma -1$的n阶矩都是有限的。 • 当$n - \gamma +1 >0 $时，随着$k_{max}增加，$$k_{max}^{n- \gamma +1} \rightarrow \infty。所有满足n > \gamma -1的n阶矩都是无极限的。 对于无标度网络而言，一般幂参数2 < \gamma < 3，所以： • 对于n = 1的情况，即一阶矩平均度$$是有限的。

• 但对于n >= 2的情况，即$k^2$或$k^3$是无极限的。二阶和高阶矩无穷大是“无标度”的来源

# 1. 连续平均场"Continuum Mean-Field"¶

### "Mean-Field": many -> one¶

The complex interaction between a large number of components can be simplified into a single averaged effect of all the other individuals on any given one.

### "Continuum": discrete -> Continuous¶

A discrete variables that is "smooth enough", i.e. increase by one unit in each period, such as time steps [1], spatial jumps [2-3], and population, can be viewed as a continuous geometric structure. Any measure on this structure, like degree [1], number of unique locations visited [2], and distance [3], can be described by differential equations.

## 模型设定¶

• 初始状态有$m_0$个节点
1. 增长原则：每次加入一个节点i （加入时间记为$t_i$）, 每个节点的加入带来m条边，2m个度的增加 其中老节点分到的度数是m，新加入的那一个节点分到的度数为m 那么到时间t的时候，网络的总节点数是$m_0 + t$，网络的总度数为$2mt$。
1. 优先链接原则：每一次从m条边中占有一条边的概率正比于节点的度$k_i$ 那么显然，加入的越早（$t_i$越小）越容易获得更多的链接数。 从时间0开始，每一个时间步系统中的节点度$k_i$是不断增加的。

## 度的增长/时间依赖性¶

$k_i$在一个时间步获得一个度的概率表示为$\prod (k_i)$， 那么有：

$\prod (k_i) = \frac{k_i}{\sum k_i} = \frac{k_i}{2mt}$

# $k_i = C (2t) ^ {-0.5}$ （1）¶

$k_i(t_i) = m$ 代入公式（1）

$k_i = m (\frac{t}{t_i})^{0.5}$ 公式（3）

## 累积概率分布¶

$P(k_i(t) < k) = P( m (\frac{t}{t_i})^{0.5} < k ) = P( t_i > \frac{m^2 t}{k^2} ) = 1 - P(t_i \leqslant \frac{m^2 t}{k^2} )$（4）

$P(t_i) = \frac{1}{m_0 + t}$ 公式（5）

### 均匀分布的性质¶

• 设连续型随机变量X的概率密度函数为 $f(x)=1/(b-a)，a≤x≤b$, 则称随机变量X服从[a,b]上的均匀分布，记为X~U[a,b]。若[x1,x2]是[a,b]的任一子区间，则 $P{x_1≤x≤x_2}=(x_2-x_1) \frac{1}{b-a}$

$P(k_i(t) < k) = 1- \frac{m^2 t}{k^2} P(t_i) = 1 - \frac{m^2 t}{k^2 (m_0 + t)}$ 公式（6）

$P( k ) = \frac{\partial P(k_i(t) < k)}{\partial k} = \frac{2m^2 t}{m_0 + t} \frac{1}{k^3}$ 公式（7）

# 参考文献¶

In [ ]:


text:
# Homework Help: Can someone explain this to me

1. Sep 7, 2009

### xpack

Let speed be s

s^2 = 4^2 + 9^2

s^2 = 377

s = 19.4 mph

Ө = Tan^(-1) [ 19/4 ] = 78.1°

3 figure bearing is thus 180 ° - 78.1 ° = 101.9 °

109.1 ° = N 11.9 ° W

Why 109.1 ° = N 11.9 ° W.

2. Sep 7, 2009

It isn't: the result is $$101.9^\circ$$, not $$109.1^\circ$$. With N at $$90^\circ$$, the result is $$11.9^\circ$$ west of that, hence the $$N 11.9^\circ W$$.


text:
Məsələlər

# Place

Rashad loves cars and he finally managed to start his own car factory! Factory has N employees, each of them has exactly one superior (except Rashad - he is by default everybody’s superior) . Rashad is denotedby number 1, and the rest of the employees with numbers 2 to N. Every employee can raise or lower the wages of all of his subordinates (both direct subordinates and those lower in the hieararchy tree). Rashad’s role is to prevent abuse of such power, so from time to time he wants to know wage of a particular employee. He is asking you to write a program which will help him monitor wage changes, given a sequence of commands described in the input section.

#### Input:

First line of input contains two space-separated positive integers N (1N500 000), number of employees, and M (1M500 000), number of wage changes and wage queries. Next N lines contain the information about employees 1, 2, ..., N (respectively): starting wage and the identifier of his direct supervisor. Remark: Rashad has no supervisor, so his line will contain only his starting wage.

Next M lines contain one of the following:

• 1) p A X - employee A increases (or decreases in case of a negative X) wage of all his subordinates by the amount X(-10 000 ≤ X ≤ 10 000);
• 2) u A - Rashad wants to know the wage of employee A.

#### Output:

Output should contain one line for each ‘2’ query in the input - the current wage of the given employee.

Zaman məhdudiyyəti 1.5 saniyə
Giriş verilənləri #1
2 3
5
3 1
p 1 5
u 2
u 1
Çıxış verilənləri #1
8
5
Giriş verilənləri #2
5 5
4
2 1
6 1
7 1
3 4
u 3
p 1 -1
u 3
p 4 5
u 5
Çıxış verilənləri #2
6
5
7
Giriş verilənləri #3
6 7
5
4 1
3 2
7 3
2 3
3 5
p 3 2
p 2 4
u 3
u 6
p 5 -2
u 6
u 1
Çıxış verilənləri #3
7
9
7
5
Mənbə IATI2019 Azerbaijan Selection based on Croatian Open Olympiad Round 3 2011/2012


text:
Revision history [back]

Vehicle plugin without control

Hi

I have designed simple model of car with ackermann steering. Also I have designed ackermann plugin to control the model. However, the model and plugin don't work in the new version Gazebo (1.3). I tried to find a similar model of car for the newest version Gazebo. I have found model of car what I was looking for. However, I was surprised that vehicle plugin for this car model don't contain subscriber of control topic. In fact, there is subscriber on cmd_vel topic, but it is empty.

void VehiclePlugin::OnVelMsg(ConstPosePtr &/*_msg*/)
{
}

There are plans to further develop the plugin?

PS. I could develop the plugin by myself. But I would like know if somebody are doing this work too.

Best Regards, Alex


text:
fitlda

Fit latent Dirichlet allocation (LDA) model

Description

A latent Dirichlet allocation (LDA) model is a topic model which discovers underlying topics in a collection of documents and infers word probabilities in topics. If the model was fit using a bag-of-n-grams model, then the software treats the n-grams as individual words.

example

mdl = fitlda(bag,numTopics) fits an LDA model with numTopics topics to the bag-of-words or bag-of-n-grams model bag.

example

mdl = fitlda(counts,numTopics) fits an LDA model to the documents represented by a matrix of frequency counts.

mdl = fitlda(___,Name,Value) specifies additional options using one or more name-value pair arguments.

Examples

collapse all

To reproduce the results in this example, set rng to 'default'.

rng('default')

Load the example data. The file sonnetsPreprocessed.txt contains preprocessed versions of Shakespeare's sonnets. The file contains one sonnet per line, with words separated by a space. Extract the text from sonnetsPreprocessed.txt, split the text into documents at newline characters, and then tokenize the documents.

filename = "sonnetsPreprocessed.txt";
str = extractFileText(filename);
textData = split(str,newline);
documents = tokenizedDocument(textData);

Create a bag-of-words model using bagOfWords.

bag = bagOfWords(documents)
bag =
bagOfWords with properties:

Counts: [154x3092 double]
Vocabulary: ["fairest"    "creatures"    "desire"    ...    ]
NumWords: 3092
NumDocuments: 154

Fit an LDA model with four topics.

numTopics = 4;
mdl = fitlda(bag,numTopics)
Initial topic assignments sampled in 0.140295 seconds.
=====================================================================================
| Iteration  |  Time per  |  Relative  |  Training  |     Topic     |     Topic     |
|            | iteration  | change in  | perplexity | concentration | concentration |
|            | (seconds)  |   log(L)   |            |               |   iterations  |
=====================================================================================
|          0 |       0.05 |            |  1.215e+03 |         1.000 |             0 |
|          1 |       0.02 | 1.0482e-02 |  1.128e+03 |         1.000 |             0 |
|          2 |       0.01 | 1.7190e-03 |  1.115e+03 |         1.000 |             0 |
|          3 |       0.01 | 4.3796e-04 |  1.118e+03 |         1.000 |             0 |
|          4 |       0.01 | 9.4193e-04 |  1.111e+03 |         1.000 |             0 |
|          5 |       0.02 | 3.7079e-04 |  1.108e+03 |         1.000 |             0 |
|          6 |       0.01 | 9.5777e-05 |  1.107e+03 |         1.000 |             0 |
=====================================================================================
mdl =
ldaModel with properties:

NumTopics: 4
WordConcentration: 1
TopicConcentration: 1
CorpusTopicProbabilities: [0.2500 0.2500 0.2500 0.2500]
DocumentTopicProbabilities: [154x4 double]
TopicWordProbabilities: [3092x4 double]
Vocabulary: ["fairest"    "creatures"    ...    ]
TopicOrder: 'initial-fit-probability'
FitInfo: [1x1 struct]

Visualize the topics using word clouds.

figure
for topicIdx = 1:4
subplot(2,2,topicIdx)
wordcloud(mdl,topicIdx);
title("Topic: " + topicIdx)
end

Fit an LDA model to a collection of documents represented by a word count matrix.

To reproduce the results of this example, set rng to 'default'.

rng('default')

Load the example data. sonnetsCounts.mat contains a matrix of word counts and a corresponding vocabulary of preprocessed versions of Shakespeare's sonnets. The value counts(i,j) corresponds to the number of times the jth word of the vocabulary appears in the ith document.

size(counts)
ans = 1×2

154        3092

Fit an LDA model with 7 topics. To suppress the verbose output, set 'Verbose' to 0.

numTopics = 7;
mdl = fitlda(counts,numTopics,'Verbose',0);

Visualize multiple topic mixtures using stacked bar charts. Visualize the topic mixtures of the first three input documents.

topicMixtures = transform(mdl,counts(1:3,:));
figure
barh(topicMixtures,'stacked')
xlim([0 1])
title("Topic Mixtures")
xlabel("Topic Probability")
ylabel("Document")
legend("Topic "+ string(1:numTopics),'Location','northeastoutside')

To reproduce the results in this example, set rng to 'default'.

rng('default')

Load the example data. The file sonnetsPreprocessed.txt contains preprocessed versions of Shakespeare's sonnets. The file contains one sonnet per line, with words separated by a space. Extract the text from sonnetsPreprocessed.txt, split the text into documents at newline characters, and then tokenize the documents.

filename = "sonnetsPreprocessed.txt";
str = extractFileText(filename);
textData = split(str,newline);
documents = tokenizedDocument(textData);

Create a bag-of-words model using bagOfWords.

bag = bagOfWords(documents)
bag =
bagOfWords with properties:

Counts: [154x3092 double]
Vocabulary: ["fairest"    "creatures"    "desire"    ...    ]
NumWords: 3092
NumDocuments: 154

Fit an LDA model with 20 topics.

numTopics = 20;
mdl = fitlda(bag,numTopics)
Initial topic assignments sampled in 0.063096 seconds.
=====================================================================================
| Iteration  |  Time per  |  Relative  |  Training  |     Topic     |     Topic     |
|            | iteration  | change in  | perplexity | concentration | concentration |
|            | (seconds)  |   log(L)   |            |               |   iterations  |
=====================================================================================
|          0 |       0.03 |            |  1.159e+03 |         5.000 |             0 |
|          1 |       0.02 | 5.4884e-02 |  8.028e+02 |         5.000 |             0 |
|          2 |       0.02 | 4.7400e-03 |  7.778e+02 |         5.000 |             0 |
|          3 |       0.02 | 3.4597e-03 |  7.602e+02 |         5.000 |             0 |
|          4 |       0.02 | 3.4662e-03 |  7.430e+02 |         5.000 |             0 |
|          5 |       0.02 | 2.9259e-03 |  7.288e+02 |         5.000 |             0 |
|          6 |       0.02 | 6.4180e-05 |  7.291e+02 |         5.000 |             0 |
=====================================================================================
mdl =
ldaModel with properties:

NumTopics: 20
WordConcentration: 1
TopicConcentration: 5
CorpusTopicProbabilities: [0.0500 0.0500 0.0500 0.0500 0.0500 ... ]
DocumentTopicProbabilities: [154x20 double]
TopicWordProbabilities: [3092x20 double]
Vocabulary: ["fairest"    "creatures"    ...    ]
TopicOrder: 'initial-fit-probability'
FitInfo: [1x1 struct]

Predict the top topics for an array of new documents.

newDocuments = tokenizedDocument([
"what's in a name? a rose by any other name would smell as sweet."
"if music be the food of love, play on."]);
topicIdx = predict(mdl,newDocuments)
topicIdx = 2×1

19
8

Visualize the predicted topics using word clouds.

figure
subplot(1,2,1)
wordcloud(mdl,topicIdx(1));
title("Topic " + topicIdx(1))
subplot(1,2,2)
wordcloud(mdl,topicIdx(2));
title("Topic " + topicIdx(2))

Input Arguments

collapse all

Input bag-of-words or bag-of-n-grams model, specified as a bagOfWords object or a bagOfNgrams object. If bag is a bagOfNgrams object, then the function treats each n-gram as a single word.

Number of topics, specified as a positive integer. For an example showing how to choose the number of topics, see Choose Number of Topics for LDA Model.

Example: 200

Frequency counts of words, specified as a matrix of nonnegative integers. If you specify 'DocumentsIn' to be 'rows', then the value counts(i,j) corresponds to the number of times the jth word of the vocabulary appears in the ith document. Otherwise, the value counts(i,j) corresponds to the number of times the ith word of the vocabulary appears in the jth document.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'Solver','avb' specifies to use approximate variational Bayes as the solver.

Solver Options

collapse all

Solver for optimization, specified as the comma-separated pair consisting of 'Solver' and one of the following:

Stochastic Solver

• 'savb' – Use stochastic approximate variational Bayes [1] [2]. This solver is best suited for large datasets and can fit a good model in fewer passes of the data.

Batch Solvers

• 'cgs' – Use collapsed Gibbs sampling [3]. This solver can be more accurate at the cost of taking longer to run. The resume function does not support models fitted with CGS.

• 'avb' – Use approximate variational Bayes [4]. This solver typically runs more quickly than collapsed Gibbs sampling and collapsed variational Bayes, but can be less accurate.

• 'cvb0' – Use collapsed variational Bayes, zeroth order [4] [5]. This solver can be more accurate than approximate variational Bayes at the cost of taking longer to run.

For an example showing how to compare solvers, see Compare LDA Solvers.

Example: 'Solver','savb'

Relative tolerance on log-likelihood, specified as the comma-separated pair consisting of 'LogLikelihoodTolerance' and a positive scalar. The optimization terminates when this tolerance is reached.

Example: 'LogLikelihoodTolerance',0.001

Option for fitting topic concentration, specified as the comma-separated pair consisting of 'FitTopicConcentration' and either true or false.

The function fits the Dirichlet prior $\alpha ={\alpha }_{0}\left(\begin{array}{cccc}{p}_{1}& {p}_{2}& \cdots & {p}_{K}\end{array}\right)$ on the topic mixtures, where ${\alpha }_{0}$ is the topic concentration and ${p}_{1},\dots ,{p}_{K}$ are the corpus topic probabilities which sum to 1.

Example: 'FitTopicProbabilities',false

Data Types: logical

Option for fitting topic concentration, specified as the comma-separated pair consisting of 'FitTopicConcentration' and either true or false.

For batch the solvers 'cgs', 'avb', and 'cvb0', the default for FitTopicConcentration is true. For the stochastic solver 'savb', the default is false.

The function fits the Dirichlet prior $\alpha ={\alpha }_{0}\left(\begin{array}{cccc}{p}_{1}& {p}_{2}& \cdots & {p}_{K}\end{array}\right)$ on the topic mixtures, where ${\alpha }_{0}$ is the topic concentration and ${p}_{1},\dots ,{p}_{K}$ are the corpus topic probabilities which sum to 1.

Example: 'FitTopicConcentration',false

Data Types: logical

Initial estimate of the topic concentration, specified as the comma-separated pair consisting of 'InitialTopicConcentration' and a nonnegative scalar. The function sets the concentration per topic to TopicConcentration/NumTopics. For more information, see Latent Dirichlet Allocation.

Example: 'InitialTopicConcentration',25

Topic order, specified as one of the following:

• 'initial-fit-probability' – Sort the topics by the corpus topic probabilities of input document set (the CorpusTopicProbabilities property).

• 'unordered' – Do not sort the topics.

Word concentration, specified as the comma-separated pair consisting of 'WordConcentration' and a nonnegative scalar. The software sets the Dirichlet prior on the topics (the word probabilities per topic) to be the symmetric Dirichlet distribution parameter with the value WordConcentration/numWords, where numWords is the vocabulary size of the input documents. For more information, see Latent Dirichlet Allocation.

Orientation of documents in the word count matrix, specified as the comma-separated pair consisting of 'DocumentsIn' and one of the following:

• 'rows' – Input is a matrix of word counts with rows corresponding to documents.

• 'columns' – Input is a transposed matrix of word counts with columns corresponding to documents.

This option only applies if you specify the input documents as a matrix of word counts.

Note

If you orient your word count matrix so that documents correspond to columns and specify 'DocumentsIn','columns', then you might experience a significant reduction in optimization-execution time.

Batch Solver Options

collapse all

Maximum number of iterations, specified as the comma-separated pair consisting of 'IterationLimit' and a positive integer.

This option supports batch solvers only ('cgs', 'avb', or 'cvb0').

Example: 'IterationLimit',200

Stochastic Solver Options

collapse all

Maximum number of passes through the data, specified as the comma-separated pair consisting of 'DataPassLimit' and a positive integer.

If you specify 'DataPassLimit' but not 'MiniBatchLimit', then the default value of 'MiniBatchLimit' is ignored. If you specify both 'DataPassLimit' and 'MiniBatchLimit', then fitlda uses the argument that results in processing the fewest observations.

This option supports only the stochastic ('savb') solver.

Example: 'DataPassLimit',2

Maximum number of mini-batch passes, specified as the comma-separated pair consisting of 'MiniBatchLimit' and a positive integer.

If you specify 'MiniBatchLimit' but not 'DataPassLimit', then fitlda ignores the default value of 'DataPassLimit'. If you specify both 'MiniBatchLimit' and 'DataPassLimit', then fitlda uses the argument that results in processing the fewest observations. The default value is ceil(numDocuments/MiniBatchSize), where numDocuments is the number of input documents.

This option supports only the stochastic ('savb') solver.

Example: 'MiniBatchLimit',200

Mini-batch size, specified as the comma-separated pair consisting of 'MiniBatchLimit' and a positive integer. The function processes MiniBatchSize documents in each iteration.

This option supports only the stochastic ('savb') solver.

Example: 'MiniBatchSize',512

Learning rate decay, specified as the comma-separated pair 'LearnRateDecay' and a positive scalar less than or equal to 1.

For mini-batch t, the function sets the learning rate to $\eta \left(t\right)=1/{\left(1+t\right)}^{\kappa }$, where $\kappa$ is the learning rate decay.

If LearnRateDecay is close to 1, then the learning rate decays faster and the model learns mostly from the earlier mini-batches. If LearnRateDecay is close to 0, then the learning rate decays slower and the model continues to learn from more mini-batches. For more information, see Stochastic Solver.

This option supports the stochastic solver only ('savb').

Example: 'LearnRateDecay',0.75

Display Options

collapse all

Validation data to monitor optimization convergence, specified as the comma-separated pair consisting of 'ValidationData' and a bagOfWords object, a bagOfNgrams object, or a sparse matrix of word counts. If the validation data is a matrix, then the data must have the same orientation and the same number of words as the input documents.

Frequency of model validation in number of iterations, specified as the comma-separated pair consisting of 'ValidationFrequency' and a positive integer.

The default value depends on the solver used to fit the model. For the stochastic solver, the default value is 10. For the other solvers, the default value is 1.

Verbosity level, specified as the comma-separated pair consisting of 'Verbose' and one of the following:

• 0 – Do not display verbose output.

• 1 – Display progress information.

Example: 'Verbose',0

Output Arguments

collapse all

Output LDA model, returned as an ldaModel object.

collapse all

Latent Dirichlet Allocation

A latent Dirichlet allocation (LDA) model is a document topic model which discovers underlying topics in a collection of documents and infers word probabilities in topics. LDA models a collection of D documents as topic mixtures ${\theta }_{1},\dots ,{\theta }_{D}$, over K topics characterized by vectors of word probabilities ${\phi }_{1},\dots ,{\phi }_{K}$. The model assumes that the topic mixtures ${\theta }_{1},\dots ,{\theta }_{D}$, and the topics ${\phi }_{1},\dots ,{\phi }_{K}$ follow a Dirichlet distribution with concentration parameters $\alpha$ and $\beta$ respectively.

The topic mixtures ${\theta }_{1},\dots ,{\theta }_{D}$ are probability vectors of length K, where K is the number of topics. The entry ${\theta }_{di}$ is the probability of topic i appearing in the dth document. The topic mixtures correspond to the rows of the DocumentTopicProbabilities property of the ldaModel object.

The topics ${\phi }_{1},\dots ,{\phi }_{K}$ are probability vectors of length V, where V is the number of words in the vocabulary. The entry ${\phi }_{iv}$ corresponds to the probability of the vth word of the vocabulary appearing in the ith topic. The topics ${\phi }_{1},\dots ,{\phi }_{K}$ correspond to the columns of the TopicWordProbabilities property of the ldaModel object.

Given the topics ${\phi }_{1},\dots ,{\phi }_{K}$ and Dirichlet prior $\alpha$ on the topic mixtures, LDA assumes the following generative process for a document:

1. Sample a topic mixture $\theta ~\text{Dirichlet}\left(\alpha \right)$. The random variable $\theta$ is a probability vector of length K, where K is the number of topics.

2. For each word in the document:

1. Sample a topic index $z~\text{Categorical}\left(\theta \right)$. The random variable z is an integer from 1 through K, where K is the number of topics.

2. Sample a word $w~\text{Categorical}\left({\phi }_{z}\right)$. The random variable w is an integer from 1 through V, where V is the number of words in the vocabulary, and represents the corresponding word in the vocabulary.

Under this generative process, the joint distribution of a document with words ${w}_{1},\dots ,{w}_{N}$, with topic mixture $\theta$, and with topic indices ${z}_{1},\dots ,{z}_{N}$ is given by

$p\left(\theta ,z,w|\alpha ,\phi \right)=p\left(\theta |\alpha \right)\prod _{n=1}^{N}p\left({z}_{n}|\theta \right)p\left({w}_{n}|{z}_{n},\phi \right),$

where N is the number of words in the document. Summing the joint distribution over z and then integrating over $\theta$ yields the marginal distribution of a document w:

$p\left(w|\alpha ,\phi \right)=\underset{\theta }{\int }p\left(\theta |\alpha \right)\prod _{n=1}^{N}\sum _{{z}_{n}}p\left({z}_{n}|\theta \right)p\left({w}_{n}|{z}_{n},\phi \right)d\theta .$

The following diagram illustrates the LDA model as a probabilistic graphical model. Shaded nodes are observed variables, unshaded nodes are latent variables, nodes without outlines are the model parameters. The arrows highlight dependencies between random variables and the plates indicate repeated nodes.

Dirichlet Distribution

The Dirichlet distribution is a continuous generalization of the multinomial distribution. Given the number of categories $K\ge 2$, and concentration parameter $\alpha$, where $\alpha$ is a vector of positive reals of length K, the probability density function of the Dirichlet distribution is given by

$p\left(\theta \mid \alpha \right)=\frac{1}{B\left(\alpha \right)}\prod _{i=1}^{K}\text{}{\theta }_{i}^{{\alpha }_{i}-1},$

where B denotes the multivariate Beta function given by

$B\left(\alpha \right)=\frac{\prod _{i=1}^{K}\text{}\Gamma \text{}\text{(}{\alpha }_{i}\right)}{\Gamma \left(\sum _{i=1}^{K}\text{}{\alpha }_{i}\right)}.$

A special case of the Dirichlet distribution is the symmetric Dirichlet distribution. The symmetric Dirichlet distribution is characterized by the concentration parameter $\alpha$, where all the elements of $\alpha$ are the same.

Stochastic Solver

The stochastic solver processes documents in mini-batches. It updates the per-topic word probabilities using a weighted sum of the probabilities calculated from each mini-batch, and the probabilities from all previous mini-batches.

For mini-batch t, the solver sets the learning rate to $\eta \left(t\right)=1/{\left(1+t\right)}^{\kappa }$, where $\kappa$ is the learning rate decay.

The function uses the learning rate decay to update $\Phi$, the matrix of word probabilities per topic, by setting

${\Phi }^{\left(t\right)}=\left(1-\eta \left(t\right)\right){\Phi }^{\left(t-1\right)}+\eta \left(t\right){\Phi }^{\left(t*\right)},$

where ${\Phi }^{\left(t*\right)}$ is the matrix learned from mini-batch t, and ${\Phi }^{\left(t-1\right)}$ is the matrix learned from mini-batches 1 through t-1.

Before learning begins (when t = 0), the function initializes the initial word probabilities per topic ${\Phi }^{\left(0\right)}$ with random values.

References

[1] Foulds, James, Levi Boyles, Christopher DuBois, Padhraic Smyth, and Max Welling. "Stochastic collapsed variational Bayesian inference for latent Dirichlet allocation." In Proceedings of the 19th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 446–454. ACM, 2013.

[2] Hoffman, Matthew D., David M. Blei, Chong Wang, and John Paisley. "Stochastic variational inference." The Journal of Machine Learning Research 14, no. 1 (2013): 1303–1347.

[3] Griffiths, Thomas L., and Mark Steyvers. "Finding scientific topics." Proceedings of the National academy of Sciences 101, no. suppl 1 (2004): 5228–5235.

[4] Asuncion, Arthur, Max Welling, Padhraic Smyth, and Yee Whye Teh. "On smoothing and inference for topic models." In Proceedings of the Twenty-Fifth Conference on Uncertainty in Artificial Intelligence, pp. 27–34. AUAI Press, 2009.

[5] Teh, Yee W., David Newman, and Max Welling. "A collapsed variational Bayesian inference algorithm for latent Dirichlet allocation." In Advances in neural information processing systems, pp. 1353–1360. 2007.

Version History

Introduced in R2017b

expand all


text:
RUS  ENG JOURNALS   PEOPLE   ORGANISATIONS   CONFERENCES   SEMINARS   VIDEO LIBRARY   PACKAGE AMSBIB
 General information Latest issue Archive Impact factor Search papers Search references RSS Latest issue Current issues Archive issues What is RSS

 SIGMA: Year: Volume: Issue: Page: Find

 SIGMA, 2012, Volume 8, 004, 10 pages (Mi sigma681)

On a Lie algebraic characterization of vector bundles

Pierre B.A. Lecomte, Thomas Leuther, Elie Zihindula Mushengezi

Institute of Mathematics, Grande Traverse 12, B-4000 Liège, Belgium

Abstract: We prove that a vector bundle $\pi\colon E\to M$ is characterized by the Lie algebra generated by all differential operators on $E$ which are eigenvectors of the Lie derivative in the direction of the Euler vector field. Our result is of Pursell–Shanks type but it is remarkable in the sense that it is the whole fibration that is characterized here. The proof relies on a theorem of [Lecomte P., J. Math. Pures Appl. (9) 60 (1981), 229–239] and inherits the same hypotheses. In particular, our characterization holds only for vector bundles of rank greater than 1.

Keywords: vector bundle, algebraic characterization, Lie algebra, differential operators.

DOI: https://doi.org/10.3842/SIGMA.2012.004

Full text: PDF file (322 kB)
Full text: http://emis.mi.ras.ru/.../004
References: PDF file   HTML file

Bibliographic databases:

ArXiv: 1109.4772
MSC: 13N10; 16S32; 17B65; 17B63
Received: September 23, 2011; in final form January 23, 2012; Published online January 26, 2012
Language:

Citation: Pierre B.A. Lecomte, Thomas Leuther, Elie Zihindula Mushengezi, “On a Lie algebraic characterization of vector bundles”, SIGMA, 8 (2012), 004, 10 pp.

Citation in format AMSBIB
\Bibitem{LecLeuZih12} \by Pierre B.A. Lecomte, Thomas Leuther, Elie Zihindula Mushengezi \paper On a Lie algebraic characterization of vector bundles \jour SIGMA \yr 2012 \vol 8 \papernumber 004 \totalpages 10 \mathnet{http://mi.mathnet.ru/sigma681} \crossref{https://doi.org/10.3842/SIGMA.2012.004} \mathscinet{http://www.ams.org/mathscinet-getitem?mr=2892331} \isi{http://gateway.isiknowledge.com/gateway/Gateway.cgi?GWVersion=2&SrcApp=PARTNER_APP&SrcAuth=LinksAMR&DestLinkType=FullRecord&DestApp=ALL_WOS&KeyUT=000299614900001} \scopus{http://www.scopus.com/record/display.url?origin=inward&eid=2-s2.0-84881515091}

• http://mi.mathnet.ru/eng/sigma681
• http://mi.mathnet.ru/eng/sigma/v8/p4

 SHARE:

Citing articles on Google Scholar: Russian citations, English citations
Related articles on Google Scholar: Russian articles, English articles

This publication is cited in the following articles:
1. Grabowski J., Kotov A., Poncin N., “Lie Superalgebras of Differential Operators”, J. Lie Theory, 23:1 (2013), 35–54
•  Number of views: This page: 195 Full text: 31 References: 23


text:
## 语言选项

short_open_tag "1" PHP_INI_PERDIR
precision "14" PHP_INI_ALL
serialize_precision "-1" PHP_INI_ALL 在 PHP 7.1.0 以前，默认值为 17。
disable_functions "" 仅为 PHP_INI_SYSTEM
disable_classes "" 仅为 php.ini
exit_on_timeout "" PHP_INI_ALL
expose_php "1" 仅为 php.ini
hard_timeout "2" PHP_INI_SYSTEM 从 PHP 7.1.0 起可用
zend.exception_ignore_args "0" PHP_INI_ALL 从 PHP 7.4.0 起可用
zend.multibyte "0" PHP_INI_ALL
zend.script_encoding NULL PHP_INI_ALL
zend.detect_unicode NULL PHP_INI_ALL
zend.signal_check "0" PHP_INI_SYSTEM
zend.assertions "1" 有限制的 PHP_INI_ALL
zend.exception_string_param_max_len "15" PHP_INI_ALL 自 PHP 8.0.0 起可用。

short_open_tag bool

precision int

serialize_precision int

expose_php bool

disable_functions string

disable_classes string

zend.assertions int

zend.exception_string_param_max_len int

hard_timeout int

Fatal error: Maximum execution time of 30+2 seconds exceeded (terminated) in Unknown on line 0

zend.exception_ignore_args bool

zend.multibyte bool

zend.script_encoding string

zend.detect_unicode bool

zend.signal_check bool

exit_on_timeout bool

## 资源限制

memory_limit "128M" PHP_INI_ALL

memory_limit int

## 性能调整

realpath_cache_size "4M" PHP_INI_SYSTEM PPHP 7.0.16 和 7.1.2 之前，默认值为 "16K"
realpath_cache_ttl "120" PHP_INI_SYSTEM

realpath_cache_size int

realpath_cache_ttl int

## 数据处理

arg_separator.output "&" PHP_INI_ALL
arg_separator.input "&" PHP_INI_PERDIR
variables_order "EGPCS" PHP_INI_PERDIR
request_order "" PHP_INI_PERDIR
auto_globals_jit "1" PHP_INI_PERDIR
register_argc_argv "1" PHP_INI_PERDIR
post_max_size "8M" PHP_INI_PERDIR
auto_prepend_file NULL PHP_INI_PERDIR
auto_append_file NULL PHP_INI_PERDIR
default_mimetype "text/html" PHP_INI_ALL
default_charset "UTF-8" PHP_INI_ALL
input_encoding "" PHP_INI_ALL
output_encoding "" PHP_INI_ALL
internal_encoding "" PHP_INI_ALL

arg_separator.output string

arg_separator.input string

PHP 用于将输入的 URL 解析为变量的分隔符列表。

variables_order string

$_REQUEST 的内容和顺序也受到此指令的影响。 request_order string 该指令描述了 PHP 将 GET、POST 和 Cookie 变量注册到 _REQUEST 数组中的顺序。注册是从左到右完成的，新值覆盖旧值。 如果未设置此指令，则 variables_order 用于$_REQUEST 内容。

auto_globals_jit bool

register_argc_argv bool

enable_post_data_reading bool

post_max_size int

PHP 允许使用字节值的快捷方式，包括 K（千）、M（兆）和 G（千兆）。如果使用其中任何一个，PHP 将自动进行转换。注意不要超过 32 位有符号整数限制（如果使用的是 32 位版本），因为这会导致脚本失败。

post_max_size 变更日志

5.3.4 post_max_size = 0 will not disable the limit when the content type is application/x-www-form-urlencoded or is not registered with PHP.
5.3.2 , 5.2.12 Allow unlimited post size by setting post_max_size to 0.

auto_prepend_file string

auto_append_file string

default_mimetype string

PHP 内置默认媒体类型设置为 text/html。

default_charset string

“UTF-8”是默认值，如果省略 encoding 参数，它的值将用作 htmlentities()html_entity_decode()htmlspecialchars() 的默认字符编码。 如果未设置 iconv.input_encodingiconv.output_encodingiconv.internal_encoding 配置选项，则 default_charset 的值也将用于设置 iconv 函数的默认字符集，如果 mbstring.http_input mbstring.http_output mbstring.internal_encoding 配置选项未设置，则也可用于 mbstring 函数。

input_encoding string

output_encoding string

internal_encoding string

## 路径和目录

include_path ".;/path/to/php/pear" PHP_INI_ALL
open_basedir NULL PHP_INI_ALL
doc_root NULL PHP_INI_SYSTEM
user_dir NULL PHP_INI_SYSTEM
user_ini.cache_ttl "300" PHP_INI_SYSTEM
user_ini.filename ".user.ini" PHP_INI_SYSTEM
extension_dir "/path/to/php" PHP_INI_SYSTEM
extension NULL php.ini only
zend_extension NULL php.ini only
cgi.check_shebang_line "1" PHP_INI_SYSTEM
cgi.fix_pathinfo "1" PHP_INI_SYSTEM
cgi.force_redirect "1" PHP_INI_SYSTEM
cgi.nph "0" PHP_INI_SYSTEM
cgi.redirect_status_env NULL PHP_INI_SYSTEM
fastcgi.impersonate "0" PHP_INI_SYSTEM
fastcgi.logging "1" PHP_INI_SYSTEM

include_path string

PHP considers each entry in the include path separately when looking for files to include. It will check the first path, and if it doesn't find it, check the next path, until it either locates the included file or returns with an E_WARNING or an E_ERROR. You may modify or set your include path at runtime using set_include_path().

include_path=".:/php/includes"

include_path=".;c:\php\includes"

Using a . in the include path allows for relative includes as it means the current directory. However, it is more efficient to explicitly use include './file' than having PHP always check the current directory for every include.

ENV variables are also accessible in .ini files. As such it is possible to reference the home directory using ${LOGIN} and ${USER}.

Environment variables may vary between Server APIs as those environments may be different.

open_basedir string

Limit the files that can be accessed by PHP to the specified directory-tree, including the file itself.

When a script tries to access the filesystem, for example using include, or fopen(), the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to access it. All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink. If the file doesn't exist then the symlink couldn't be resolved and the filename is compared to (a resolved) open_basedir.

open_basedir can affect more than just filesystem functions; for example if MySQL is configured to use mysqlnd drivers, LOAD DATA INFILE will be affected by open_basedir. Much of the extended functionality of PHP uses open_basedir in this way.

The special value . indicates that the working directory of the script will be used as the base-directory. This is, however, a little dangerous as the working directory of the script can easily be changed with chdir().

In httpd.conf, open_basedir can be turned off (e.g. for some virtual hosts) the same way as any other configuration directive with "php_admin_value open_basedir none".

Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon. As an Apache module, open_basedir paths from parent directories are now automatically inherited.

The restriction specified with open_basedir is a directory name, not a prefix.

The default is to allow all files to be opened.

open_basedir can be tightened at run-time. This means that if open_basedir is set to /www/ in php.ini a script can tighten the configuration to /www/tmp/ at run-time with ini_set(). When listing several directories, you can use the PATH_SEPARATOR constant as a separator regardless of the operating system.

Using open_basedir will set realpath_cache_size to 0 and thus disable the realpath cache.

open_basedir 只是额外的安全保障，并不全面，因此在需要安全性时并不能依赖它。

doc_root string

PHP's "root directory" on the server. Only used if non-empty. If PHP was not compiled with FORCE_REDIRECT, you should set doc_root if you are running PHP as a CGI under any web server (other than IIS). The alternative is to use the cgi.force_redirect configuration below.

user_ini.cache_ttl int

user_ini.filename string

user_dir string

The base name of the directory used on a user's home directory for PHP files, for example public_html .

extension_dir string

PHP 寻找可动态加载扩展的目录。建议指定绝对路径。参阅 enable_dldl()

extension string

zend_extension string

Name of dynamically loadable Zend extension (for example XDebug) to load when PHP starts up.

cgi.check_shebang_line bool

Controls whether CGI PHP checks for line starting with #! (shebang) at the top of the running script. This line might be needed if the script support running both as stand-alone script and via PHP CGI. PHP in CGI mode skips this line and ignores its content if this directive is turned on.

cgi.discard_path bool

If this is enabled, the PHP CGI binary can safely be placed outside of the web tree and people will not be able to circumvent .htaccess security.

cgi.fix_pathinfo bool

Provides real PATH_INFO/ PATH_TRANSLATED support for CGI. PHP's previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok what  PATH_INFO is. For more information on PATH_INFO, see the CGI specs. Setting this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting of zero causes PHP to behave as before. It is turned on by default. You should fix your scripts to use SCRIPT_FILENAME rather than PATH_TRANSLATED.

cgi.force_redirect bool

cgi.force_redirect is necessary to provide security running PHP as a CGI under most web servers. Left undefined, PHP turns this on by default. You can turn it off at your own risk.

Windows Users: When using IIS this option must be turned off. For OmniHTTPD or Xitami the same applies.

cgi.nph bool

If cgi.nph is enabled it will force cgi to always sent Status: 200 with every request.

cgi.redirect_status_env string

If cgi.force_redirect is turned on, and you are not running under Apache or Netscape (iPlanet) web servers, you may need to set an environment variable name that PHP will look for to know it is OK to continue execution.

Setting this variable may cause security issues, know what you are doing first.

cgi.rfc2616_headers int

Tells PHP what type of headers to use when sending HTTP response code. If it's set to 0, PHP sends a » RFC 3875 "Status:" header that is supported by Apache and other web servers. When this option is set to 1, PHP will send » RFC 2616 compliant headers.

If this option is enabled, and you are running PHP in a CGI environment (e.g. PHP-FPM) you should not use standard RFC 2616 style HTTP status response headers, you should instead use their RFC 3875 equivalent e.g. instead of header("HTTP/1.0 404 Not found"); you should use header("Status: 404 Not Found");

Leave it set to 0 unless you know what you're doing.

fastcgi.impersonate string

FastCGI under IIS (on WINNT based OS) supports the ability to impersonate security tokens of the calling client. This allows IIS to define the security context that the request runs under. mod_fastcgi under Apache does not currently support this feature (03/17/2002) Set to 1 if running under IIS. Default is zero.

fastcgi.logging bool

Turns on SAPI logging when using FastCGI. Default is to enable logging.

## 文件上传

max_input_nesting_level 64 PHP_INI_PERDIR
max_input_vars 1000 PHP_INI_PERDIR

file_uploads bool

upload_tmp_dir string

upload_max_filesize int

post_max_size 必须大于此值。

max_file_uploads int

## 常规 SQL

sql.safe_mode "0" PHP_INI_SYSTEM 自 PHP 7.2.0 起移除

sql.safe_mode bool

If turned on, database connection functions that specify default values will use those values in place of any user-supplied arguments. For details on the default values, see the documentation for the relevant connection functions.

## Windows 专用

Windows 专用配置选项

windows.show_crt_warning "0" PHP_INI_ALL

windows.show_crt_warning bool

### User Contributed Notes 20 notes

andre dot wetter at myelco dot ch
1 year ago
 If you use Microsoft IIS Windows and want to use open_basedir restrictions with multiple dirs you have to set them into single quotes in the main config xml file of IIS (C:\Windows\System32\inetsrv\config\applicationHost.config). Works fine in IIS 10.Multiple files with single quotes and ; for windows:"C:\php\php-cgi.exe|-d open_basedir='C:\Windows\Temp\;D:\mywebsite1\'"Only one dir works fine without single quotes:"C:\php\php-cgi.exe|-d open_basedir=D:\mywebsite1\"In my main config xml file of IIS there are 2 nodes to set per website and the definitions have to be equal:configuration\Location\system.webServer\handlers\addconfiguration\system.webServer\fastCgi
21
csg at DEL_THISdiatom dot de
17 years ago
 Starting with PHP 4.4.0 (at least PHP version 4.3.10 did have old, documented behaviour) interpretation of value of "session.save_path" did change in conjunction with "save_mode" and "open_basedir" enabled.Documented ( http://de.php.net/manual/en/ref.session.php#ini.session.save-path ):  Values of "session.save_path" should or may be  **without**  ending slash.  For instance:<?php  // Valid only  *before* PHP 4.4.0:  ini_set( "session.save_path", "/var/httpd/kunde/phptmp" );?> will mean:  The directory "/var/httpd/kunde/phptmp/" will be used to write data and therefore must be writable by the web server.Starting with PHP 4.4.0 the server complains that "/var/httpd/kunde/" is not writable.Solution: Add an ending slash in call of ini_set (or probably whereever you set "session.save_path"), e.g.:<?php  // Note the slash on ".....phptmp/":  ini_set( "session.save_path", "/var/httpd/kunde/phptmp/" );?>Hope, that does help someone.
Simone Pellegatta
2 years ago
 Be careful while using auto_prepend_file.When the custom exception handler, set by set_exception_handler(), handles an uncaught exception, it interrupts the execution of every script.If the script with the unhandled exception has been automatically prepended or included by an automatically prepended script, however, the main script will continue running anyway.This could cause several issues: when we think that throwing an exception would automatically interrupt the current application, a whole chunk of code is going to run anyway.
luisdev
3 years ago
 https://haydenjames.io/understanding-php-memory_limit/ explains the memory_limit setting nicely.
Anton Bannikov
2 years ago
 I had a problem with 'open_basedir =' string in php.ini. This string was writtren in VirtualHost Directory directive of Apache2 and successfully rewrote the same php.ini setting! It happened with VestaCP, but I think, it's a common way. Goog luck!
rlammers at linuxmail dot org
12 years ago
 This is a possible solution for a problem which seems to be a php-ini-problem but is not.If a $_POST is used with large fields e.g. textarea's with more than 120kb characters php returns a blank screen, even if the max_post_size is 8M.This problem may be caused by an apache-module SecFilter.Adding the following lines to the .htaccess solves the problem.SecFilterEngine OffSecFilterScanPOST OffI know this is not a php-issue, but i'm still posting it here since it looks like it is a php-problem and I did not find any sites or forums offering this solution.  -1 amolitor at molitor-design dot com 13 years ago  Amusingly, the include_path logically includes the current directory of the running file as the last entry all the time anyways, so part of the business about shoving "." into the include_path is spurious -- it's "there" on the end all the time, at least in the 5.2.12 source (see main/fopen_wrappers.c around line 503).This one had me goin' for a while.  -2 dougal at gunters dot org 7 years ago  It appears that if you use both the 'include_path' directives and 'open_basedir', that file searches will hit the include path *first*, before local files. But if 'open_basedir' is not in use, then local files are found first. For example, suppose you have code in '/var/www/myfile.php' which does:<?php require_once('config.php');?>Further, assume that there is a local file '/var/www/config.php', and there is also a file '/var/local/php/config.php'.Next, if your php.ini has: include_path = /var/local/php/Normally, this would look for '/var/www/config.php' first, and if not found, then it would try '/var/local/php/config.php'.But if you also have this in php.ini: open_basedir = /var/www/:/var/local/php/Then the require would reverse the order of the search, and load '/var/local/php/config.php', even when the local 'config.php' file exists.Furthermore, if include_path contains directories not in open_basedir, you can end up with a fatal error. For example, change the directive to: open_basedir = /var/www/:/var/local/includes/php/Now the require will first find '/var/local/php/config.php' from the include_path, try to include it, but be unable to because of the open_basedir restrictions.  -2 fernandobasso dot br at gmail dot com 6 years ago  This might help in case someone happens to maintain old applications with a charset other than utf-8.According to the docs, you can override the default charset if you use header().Suppose php.ini sets the default_charset to "UTF-8", but you need a legacy charset, like ISO-8859-1.Still,<?php header('Content-Type: text/html; Charset=ISO-8859-1'); ?>would not override the charset, just add it as well and the resultwas a response header like (note the two charsets): Content-Type:"text/html; Charset=ISO-8859-1;charset=UTF-8"I found it strange the default one as charset with a lowercase cas opposed to my custom charset with an uppercase C.What solved was to _override_ the charset using all lowercase lettersas well for the word “charset”:<?php header('content-type: text/html; charset=ISO-8859-1'); ?>Then, the double charset from the response headers disappeared, and only the single, custom charset remained.  -2 leo at korfu dot cz 16 years ago  "If the size of post data is greater than post_max_size..."It seems that a more elegant way is comparison between post_max_size and$_SERVER['CONTENT_LENGTH']. Please note that the latter includes not only size of uploaded file plus post data but also multipart sequences. Leo
-3
mrok at mrok dot com
14 years ago
 Note that on some Unix systems (i.e. PHP 5.1.6 on Centos 5.2) include_path in php.ini should NOT be quoted.For example, instead of include_path='.:/usr/share/php'use include_path=.:/usr/share/phpUsing quotes does not cause any error message, but all of your require_once() directives will fail (indicating that file could not be opened) - unless full path to target file is provided.
-5
txyoji at yahoo dot com
9 years ago
 If you enable "open_basedir" option, it will disable the realpath_cache. This can be a significant performance hit.https://bugs.php.net/bug.php?id=53263
-5
AntonioK
12 years ago
 Note that there is no way to disable eval() work by using disable_functions directive, because eval() is a language construct and not a function.Many people advise to disable such potentially-insecure functions like system(), exec(), passthru(), eval() and so on in php.ini when not running in safe mode, but eval() would still work even it listed in disable_functions.
-3
4 years ago
 add enctype="multipart/form-data" to your <form> tag or it will not upload any file even if file_uploads=onex:<form method="POST" action="upload. php" enctype="multipart/form-data">// form contents</form>
-6
iko at vision dot sk
10 years ago
 auto_globals_jit setting is also affecting \$_REQUEST superglobal in 5.3 It is not explicitly stated in documentation.
-4
diamondeagle at webmail dot co dot za
3 years ago
 Note regarding the upload_tmp_dir setting and UNC Paths:When using PHP on Windows OS and IIS FastCGI, if you need to use a UNC path to a folder on a network drive for the upload_tmp_dir setting then you must use three \ characters at the front of the UNC path. Windows and PHP use the first slash as an escape character, so if you only use two slashes then it passes a UNC path with just one backslash. That is not valid for UNC paths and you many experience problems when uploading files, such as errors saying that "PHP is missing a temporary folder".Correct:upload_tmp_dir = "\\\path\to\your\folder"Incorrect:upload_tmp_dir = "\\path\to\your\folder"
-9
kghbln
11 years ago
 Adding multiple directories to open_basedir:open_basedir = "/var/www/htdocs/:/var/www/tmp/" adds both paths /var/www/htdocs/ and /var/www/tmp/. Do not forget the trailing slash, otherwise the last directory will be considered as a prefix (< 5.3.4).On Windows you use ; as the seperator.
-11
 Remember that open_basedir restriction does not affect exec functions. As long as you do not disable exec functions (see disable_functions, users will be able to use exec("/bin/cat [...]") to access sensitive world readable files.
 the ini-setting "detect_unicode" is indeed "zend.detect_unicode" (according to the phpinfo of my 5.4.4)
 Please illuminate this:memory_limit=128mb meaning which?1-per script only then if in a moment 1000 user request php script maximum only 128mb of server ram use6 by script.2-per script + per user if in a moment 1000 user request a php script about 1000*128mb=128gb ram use by script.Thanks